mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-23 23:20:33 +00:00
Fix refactoring of retired fixUniversalNumber
This commit is contained in:
@@ -1527,8 +1527,7 @@ mulRoundImpl(STAmount const& v1, STAmount const& v2, Asset const& asset, bool ro
|
||||
|
||||
bool const resultNegative = v1.negative() != v2.negative();
|
||||
|
||||
if (asset.holds<MPTIssue>() && isFeatureEnabled(featureMPTokensV2, false) &&
|
||||
getSTNumberSwitchover())
|
||||
if (asset.holds<MPTIssue>() && isFeatureEnabled(featureMPTokensV2, false))
|
||||
{
|
||||
// MPT DEX can combine 63-bit MPT amounts with IOU-shaped transfer
|
||||
// rates. Use Number arithmetic under MPTokensV2 so the rounded
|
||||
@@ -1630,8 +1629,7 @@ divRoundImpl(STAmount const& num, STAmount const& den, Asset const& asset, bool
|
||||
|
||||
bool const resultNegative = (num.negative() != den.negative());
|
||||
|
||||
if (asset.holds<MPTIssue>() && isFeatureEnabled(featureMPTokensV2, false) &&
|
||||
getSTNumberSwitchover())
|
||||
if (asset.holds<MPTIssue>() && isFeatureEnabled(featureMPTokensV2, false))
|
||||
{
|
||||
// Match the multiply path above: Number performs the rounded
|
||||
// operation, then STAmount materializes the final MPT amount using the
|
||||
|
||||
@@ -1060,7 +1060,7 @@ public:
|
||||
return Rules{mptV2 ? kMptV2Features : kNoFeatures};
|
||||
};
|
||||
|
||||
auto throwsOverflow = [&](auto&& f) {
|
||||
auto throwsOverflow = [&](auto&& f, bool expected = true) {
|
||||
bool threw = false;
|
||||
try
|
||||
{
|
||||
@@ -1070,12 +1070,11 @@ public:
|
||||
{
|
||||
threw = true;
|
||||
}
|
||||
BEAST_EXPECT(threw);
|
||||
BEAST_EXPECT(threw == expected);
|
||||
};
|
||||
|
||||
{
|
||||
CurrentTransactionRulesGuard const rg(rules(false));
|
||||
NumberSO const numberSO{true};
|
||||
|
||||
throwsOverflow([&] { (void)multiplyRound(largeAmount, transferRate, asset, true); });
|
||||
throwsOverflow([&] { (void)divideRound(scaledAmount, transferRate, asset, true); });
|
||||
@@ -1083,15 +1082,15 @@ public:
|
||||
|
||||
{
|
||||
CurrentTransactionRulesGuard const rg(rules(true));
|
||||
NumberSO const numberSO{false};
|
||||
|
||||
throwsOverflow([&] { (void)multiplyRound(largeAmount, transferRate, asset, true); });
|
||||
throwsOverflow([&] { (void)divideRound(scaledAmount, transferRate, asset, true); });
|
||||
throwsOverflow(
|
||||
[&] { (void)multiplyRound(largeAmount, transferRate, asset, true); }, false);
|
||||
throwsOverflow(
|
||||
[&] { (void)divideRound(scaledAmount, transferRate, asset, true); }, false);
|
||||
}
|
||||
|
||||
{
|
||||
CurrentTransactionRulesGuard const rg(rules(true));
|
||||
NumberSO const numberSO{true};
|
||||
STAmount const one{asset, 1};
|
||||
STAmount const two{asset, 2};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user