From 4ff40d4954dfaa237c8b708c2126cb39566776da Mon Sep 17 00:00:00 2001 From: seelabs Date: Thu, 30 Mar 2017 11:39:19 -0400 Subject: [PATCH] Enforce rippling constraints between offers and direct steps --- src/ripple/app/paths/impl/DirectStep.cpp | 15 +++++++++++++-- src/ripple/ledger/View.h | 3 +++ src/ripple/ledger/impl/View.cpp | 14 ++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/ripple/app/paths/impl/DirectStep.cpp b/src/ripple/app/paths/impl/DirectStep.cpp index 91440500940..61e8977312a 100644 --- a/src/ripple/app/paths/impl/DirectStep.cpp +++ b/src/ripple/app/paths/impl/DirectStep.cpp @@ -589,6 +589,7 @@ TER DirectStepI::check (StrandContext const& ctx) const return temBAD_PATH; } + auto sleLine = ctx.view.read (keylet::line (src_, dst_, currency_)); { auto sleSrc = ctx.view.read (keylet::account (src_)); if (!sleSrc) @@ -599,8 +600,6 @@ TER DirectStepI::check (StrandContext const& ctx) const return terNO_ACCOUNT; } - auto sleLine = ctx.view.read (keylet::line (src_, dst_, currency_)); - if (!sleLine) { JLOG (j_.trace()) << "DirectStepI: No credit line. " << *this; @@ -637,6 +636,18 @@ TER DirectStepI::check (StrandContext const& ctx) const if (ter != tesSUCCESS) return ter; } + + if (fix1449(ctx.view.info().parentCloseTime)) + { + if (ctx.prevStep->bookStepBook()) + { + auto const noRippleSrcToDst = + ((*sleLine)[sfFlags] & + ((src_ > dst_) ? lsfHighNoRipple : lsfLowNoRipple)); + if (noRippleSrcToDst) + return terNO_RIPPLE; + } + } } { diff --git a/src/ripple/ledger/View.h b/src/ripple/ledger/View.h index 95d77dacd54..d6717b5a27c 100644 --- a/src/ripple/ledger/View.h +++ b/src/ripple/ledger/View.h @@ -347,6 +347,9 @@ bool amendmentRIPD1298 (NetClock::time_point const closeTime); NetClock::time_point const& amendmentRIPD1443SoTime (); bool amendmentRIPD1443 (NetClock::time_point const closeTime); +NetClock::time_point const& fix1449SoTime (); +bool fix1449 (NetClock::time_point const closeTime); + } // ripple #endif diff --git a/src/ripple/ledger/impl/View.cpp b/src/ripple/ledger/impl/View.cpp index 89aadb0890f..d2bd90caa7a 100644 --- a/src/ripple/ledger/impl/View.cpp +++ b/src/ripple/ledger/impl/View.cpp @@ -86,6 +86,20 @@ bool amendmentRIPD1443 (NetClock::time_point const closeTime) return closeTime > amendmentRIPD1443SoTime(); } +NetClock::time_point const& fix1449SoTime () +{ + using namespace std::chrono_literals; + // Thurs, Mar 30, 2017 01:00:00pm PDT + static NetClock::time_point const soTime{544219200s}; + + return soTime; +} + +bool fix1449 (NetClock::time_point const closeTime) +{ + return closeTime > fix1449SoTime(); +} + // VFALCO NOTE A copy of the other one for now /** Maximum number of entries in a directory page A change would be protocol-breaking.