Skip to content

Commit

Permalink
Enforce rippling constraints between offers and direct steps
Browse files Browse the repository at this point in the history
  • Loading branch information
seelabs committed Mar 30, 2017
1 parent 0d4fe46 commit 4ff40d4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/ripple/app/paths/impl/DirectStep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
}
}

{
Expand Down
3 changes: 3 additions & 0 deletions src/ripple/ledger/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 14 additions & 0 deletions src/ripple/ledger/impl/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 4ff40d4

Please sign in to comment.