diff --git a/src/ripple/app/paths/impl/BookStep.cpp b/src/ripple/app/paths/impl/BookStep.cpp index 8d391ff06..61a33d147 100644 --- a/src/ripple/app/paths/impl/BookStep.cpp +++ b/src/ripple/app/paths/impl/BookStep.cpp @@ -714,14 +714,12 @@ BookStep::revImp ( result.out = out; this->consumeOffer (sb, offer, ofrAdjAmt, stpAdjAmt, ownerGivesAdj); - // When the mantissas of two iou amounts differ by less than ten, then - // subtracting them leaves a result of zero. This can cause the check for - // (stpAmt.out > remainingOut) to incorrectly think an offer will be funded - // after subtracting remainingIn. - if (fix1298(sb.parentCloseTime())) - return offer.fully_consumed(); - else - return false; + // Explicitly check whether the offer is funded. Given that we have + // (stpAmt.out > remainingOut), it's natural to assume the offer + // will still be funded after consuming remainingOut but that is + // not always the case. If the mantissas of two IOU amounts differ + // by less than ten, then subtracting them leaves a zero. + return offer.fully_consumed(); } }; @@ -884,10 +882,7 @@ BookStep::fwdImp ( // subtracting them leaves a result of zero. This can cause the check for // (stpAmt.in > remainingIn) to incorrectly think an offer will be funded // after subtracting remainingIn. - if (fix1298(sb.parentCloseTime())) - processMore = processMore || offer.fully_consumed(); - - return processMore; + return processMore || offer.fully_consumed(); }; { diff --git a/src/ripple/ledger/View.h b/src/ripple/ledger/View.h index 8eab51c85..42a1fa646 100644 --- a/src/ripple/ledger/View.h +++ b/src/ripple/ledger/View.h @@ -328,9 +328,6 @@ transferXRP (ApplyView& view, STAmount const& amount, beast::Journal j); -[[nodiscard]] NetClock::time_point const& fix1298Time (); -[[nodiscard]] bool fix1298 (NetClock::time_point const closeTime); - [[nodiscard]] NetClock::time_point const& fix1443Time (); [[nodiscard]] bool fix1443 (NetClock::time_point const closeTime); diff --git a/src/ripple/ledger/impl/View.cpp b/src/ripple/ledger/impl/View.cpp index d742e459d..111b9a02d 100644 --- a/src/ripple/ledger/impl/View.cpp +++ b/src/ripple/ledger/impl/View.cpp @@ -33,20 +33,6 @@ namespace ripple { -NetClock::time_point const& fix1298Time () -{ - using namespace std::chrono_literals; - // Wed Dec 21, 2016 18:00:00 UTC - static NetClock::time_point const soTime{535658400s}; - - return soTime; -} - -bool fix1298 (NetClock::time_point const closeTime) -{ - return closeTime > fix1298Time(); -} - NetClock::time_point const& fix1443Time () { using namespace std::chrono_literals; diff --git a/src/test/app/Flow_test.cpp b/src/test/app/Flow_test.cpp index d1274d43f..564e1e4ea 100644 --- a/src/test/app/Flow_test.cpp +++ b/src/test/app/Flow_test.cpp @@ -935,21 +935,14 @@ struct Flow_test : public beast::unit_test::suite txflags(tfPartialPayment | tfNoRippleDirect)); } - void testUnfundedOffer (bool withFix, FeatureBitset features) + void testUnfundedOffer (FeatureBitset features) { - testcase(std::string("Unfunded Offer ") + - (withFix ? "with fix" : "without fix")); + testcase("Unfunded Offer"); using namespace jtx; { // Test reverse Env env(*this, features); - auto closeTime = fix1298Time(); - if (withFix) - closeTime += env.closed()->info().closeTimeResolution; - else - closeTime -= env.closed()->info().closeTimeResolution; - env.close(closeTime); auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -968,20 +961,11 @@ struct Flow_test : public beast::unit_test::suite env(pay(alice, bob, tinyAmt1), path(~USD), sendmax(drops(9000000000)), txflags(tfNoRippleDirect)); - if (withFix) - BEAST_EXPECT(!isOffer(env, gw, XRP(0), USD(0))); - else - BEAST_EXPECT(isOffer(env, gw, XRP(0), USD(0))); + BEAST_EXPECT(!isOffer(env, gw, XRP(0), USD(0))); } { // Test forward Env env(*this, features); - auto closeTime = fix1298Time(); - if (withFix) - closeTime += env.closed()->info().closeTimeResolution; - else - closeTime -= env.closed()->info().closeTimeResolution; - env.close(closeTime); auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -1002,10 +986,7 @@ struct Flow_test : public beast::unit_test::suite env(pay(alice, bob, drops(9000000000)), path(~XRP), sendmax(USD(1)), txflags(tfNoRippleDirect)); - if (withFix) - BEAST_EXPECT(!isOffer(env, gw, USD(0), XRP(0))); - else - BEAST_EXPECT(isOffer(env, gw, USD(0), XRP(0))); + BEAST_EXPECT(!isOffer(env, gw, USD(0), XRP(0))); } } @@ -1232,8 +1213,7 @@ struct Flow_test : public beast::unit_test::suite testSelfPayment2(features); testSelfFundedXRPEndpoint(false, features); testSelfFundedXRPEndpoint(true, features); - testUnfundedOffer(true, features); - testUnfundedOffer(false, features); + testUnfundedOffer(features); testReexecuteDirectStep(features | fix1368); testSelfPayLowQualityOffer(features); } diff --git a/src/test/app/Offer_test.cpp b/src/test/app/Offer_test.cpp index 2a219b9ed..037cdc20c 100644 --- a/src/test/app/Offer_test.cpp +++ b/src/test/app/Offer_test.cpp @@ -331,7 +331,7 @@ public: // needed for this offer, it will incorrectly compute zero in both // the forward and reverse passes (when the stAmountCalcSwitchover2 // is inactive.) - env (offer (erin, drops (1), USD (1))); + env (offer (erin, drops (2), USD (2))); env (pay (alice, bob, USD (1)), path (~USD), sendmax (XRP (102)), diff --git a/src/test/app/PayStrand_test.cpp b/src/test/app/PayStrand_test.cpp index 594444ea9..7f0835d35 100644 --- a/src/test/app/PayStrand_test.cpp +++ b/src/test/app/PayStrand_test.cpp @@ -635,9 +635,6 @@ struct PayStrandAllPairs_test : public beast::unit_test::suite ExistingElementPool eep; Env env(*this, features); - auto const closeTime = fix1298Time() + - 100 * env.closed()->info().closeTimeResolution; - env.close(closeTime); eep.setupEnv(env, /*numAcc*/ 9, /*numCur*/ 6, boost::none); env.close();