Enforce rippling constraints during payments

This commit is contained in:
seelabs
2017-03-11 14:53:15 -05:00
committed by Nik Bougalis
parent d8a5f5b094
commit 0b187a6a4e
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;
}