mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Fix unfunded offer not removed (RIPD-1298):
If the mantissas of two non-native amounts differ by less than 10, then subtracting them leaves a result of zero. This can cause situations where `a>b`, yet `a-b == 0`. One consequence of this is unfunded offers were incorrectly left in order books. The code would check if the offer would be consumed (`amount in offer > amount needed`), assume it wouldn't be, yet when `amount needed` was subtracted from `amount in offer` the result was zero and the offer was unfunded. This unfunded offer incorrectly remained on the order book. This patch fixes this bug.
This commit is contained in:
@@ -58,6 +58,20 @@ bool amendmentRIPD1274 (NetClock::time_point const closeTime)
|
||||
return closeTime > amendmentRIPD1274SoTime();
|
||||
}
|
||||
|
||||
NetClock::time_point const& amendmentRIPD1298SoTime ()
|
||||
{
|
||||
using namespace std::chrono_literals;
|
||||
// TBD Move this date up when we know the release date
|
||||
// Thu Jan 5, 2017 10:00:00am PDT
|
||||
static NetClock::time_point const soTime{536954400s};
|
||||
return soTime;
|
||||
}
|
||||
|
||||
bool amendmentRIPD1298 (NetClock::time_point const closeTime)
|
||||
{
|
||||
return closeTime > amendmentRIPD1298SoTime();
|
||||
}
|
||||
|
||||
// VFALCO NOTE A copy of the other one for now
|
||||
/** Maximum number of entries in a directory page
|
||||
A change would be protocol-breaking.
|
||||
|
||||
Reference in New Issue
Block a user