mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 00:36:48 +00:00
handle createGuards change and addressed minor pr comment
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
This commit is contained in:
@@ -131,7 +131,6 @@ useRulesGuards(Rules const& rules);
|
||||
void
|
||||
createGuards(
|
||||
Rules const& rules,
|
||||
std::optional<NumberSO>& stNumberSO,
|
||||
std::optional<CurrentTransactionRulesGuard>& rulesGuard,
|
||||
std::optional<NumberMantissaScaleGuard>& mantissaScaleGuard);
|
||||
|
||||
|
||||
@@ -83,7 +83,6 @@ useRulesGuards(Rules const& rules)
|
||||
void
|
||||
createGuards(
|
||||
Rules const& rules,
|
||||
std::optional<NumberSO>& stNumberSO,
|
||||
std::optional<CurrentTransactionRulesGuard>& rulesGuard,
|
||||
std::optional<NumberMantissaScaleGuard>& mantissaScaleGuard)
|
||||
{
|
||||
@@ -91,7 +90,6 @@ createGuards(
|
||||
{
|
||||
// raii classes for the current ledger rules.
|
||||
// fixUniversalNumber predates the rulesGuard and should be replaced.
|
||||
stNumberSO.emplace(rules.enabled(fixUniversalNumber));
|
||||
rulesGuard.emplace(rules);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -839,27 +839,25 @@ STAmount::canonicalize()
|
||||
if (asset_.holds<MPTIssue>() && offset_ > 18)
|
||||
Throw<std::runtime_error>("MPT amount out of range");
|
||||
|
||||
Number const num(isNegative_, value_, offset_, Number::Unchecked{});
|
||||
auto set = [&](auto const& val) {
|
||||
auto const value = val.value();
|
||||
isNegative_ = value < 0;
|
||||
value_ = isNegative_ ? -value : value;
|
||||
};
|
||||
if (native())
|
||||
{
|
||||
Number const num(isNegative_, value_, offset_, Number::Unchecked{});
|
||||
auto set = [&](auto const& val) {
|
||||
auto const value = val.value();
|
||||
isNegative_ = value < 0;
|
||||
value_ = isNegative_ ? -value : value;
|
||||
};
|
||||
if (native())
|
||||
{
|
||||
set(XRPAmount{num});
|
||||
}
|
||||
else if (asset_.holds<MPTIssue>())
|
||||
{
|
||||
set(MPTAmount{num});
|
||||
}
|
||||
else
|
||||
{
|
||||
Throw<std::runtime_error>("Unknown integral asset type");
|
||||
}
|
||||
offset_ = 0;
|
||||
set(XRPAmount{num});
|
||||
}
|
||||
else if (asset_.holds<MPTIssue>())
|
||||
{
|
||||
set(MPTAmount{num});
|
||||
}
|
||||
else
|
||||
{
|
||||
Throw<std::runtime_error>("Unknown integral asset type");
|
||||
}
|
||||
offset_ = 0;
|
||||
|
||||
if (native() && value_ > kMaxNativeN)
|
||||
{
|
||||
|
||||
@@ -71,7 +71,7 @@ withTxnType(Rules const& rules, TxType txnType, F&& f)
|
||||
//
|
||||
std::optional<CurrentTransactionRulesGuard> rulesGuard;
|
||||
std::optional<NumberMantissaScaleGuard> mantissaScaleGuard;
|
||||
createGuards(rules, std::nullopt, rulesGuard, mantissaScaleGuard);
|
||||
createGuards(rules, rulesGuard, mantissaScaleGuard);
|
||||
|
||||
switch (txnType)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user