Enforce rippling constraints between offers and direct steps

This commit is contained in:
seelabs
2017-03-30 11:39:19 -04:00
parent 0d4fe469c6
commit 4ff40d4954
3 changed files with 30 additions and 2 deletions

View File

@@ -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;
}
}
}
{

View File

@@ -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

View File

@@ -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.