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