Enforce rippling constraints during payments

This commit is contained in:
seelabs
2017-03-11 14:53:15 -05:00
parent 6cea5d0838
commit ffa79ac6a5
4 changed files with 91 additions and 0 deletions

View File

@@ -684,6 +684,26 @@ BookStep<TIn, TOut>::check(StrandContext const& ctx) const
return temBAD_PATH_LOOP;
}
if (amendmentRIPD1443(ctx.view.info().parentCloseTime))
{
if (ctx.prevStep)
{
if (auto const prev = ctx.prevStep->directStepSrcAcct())
{
auto const& view = ctx.view;
auto const& cur = book_.in.account;
auto sle =
view.read(keylet::line(*prev, cur, book_.in.currency));
if (!sle)
return terNO_LINE;
if ((*sle)[sfFlags] &
((cur > *prev) ? lsfHighNoRipple : lsfLowNoRipple))
return terNO_RIPPLE;
}
}
}
return tesSUCCESS;
}

View File

@@ -344,6 +344,9 @@ bool amendmentRIPD1274 (NetClock::time_point const closeTime);
NetClock::time_point const& amendmentRIPD1298SoTime ();
bool amendmentRIPD1298 (NetClock::time_point const closeTime);
NetClock::time_point const& amendmentRIPD1443SoTime ();
bool amendmentRIPD1443 (NetClock::time_point const closeTime);
} // ripple
#endif

View File

@@ -72,6 +72,20 @@ bool amendmentRIPD1298 (NetClock::time_point const closeTime)
return closeTime > amendmentRIPD1298SoTime();
}
NetClock::time_point const& amendmentRIPD1443SoTime ()
{
using namespace std::chrono_literals;
// Sat Mar 11, 2017 05:00:00pm PST
static NetClock::time_point const soTime{542595600s};
return soTime;
}
bool amendmentRIPD1443 (NetClock::time_point const closeTime)
{
return closeTime > amendmentRIPD1443SoTime();
}
// VFALCO NOTE A copy of the other one for now
/** Maximum number of entries in a directory page
A change would be protocol-breaking.