mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Always enable fix1298 dated December 21, 2016 18:00:00 UTC
This commit is contained in:
committed by
Manoj doshi
parent
0964379a66
commit
70c21f90b9
@@ -714,14 +714,12 @@ BookStep<TIn, TOut, TDerived>::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<TIn, TOut, TDerived>::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();
|
||||
};
|
||||
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)),
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user