mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-20 10:35:50 +00:00
Fix limiting step re-execute bug (RIPD-1368):
The deferred credits table can compute a balance that's different from the ledger balance. Syntax: A number written with no decimal means that number exactly. I.e. "12". A number written with a decimal means that number has a non-zero digit at the lowest order digit. I.e. "12.XX" means a number like "12.00000000000005" Consider the following payment: alice (USD) -> USD/XRP -> (XRP) Bob Alice initially has 12.XX USD in her account. The strand is used to debit alice the following amounts: 1) Debit alice 5 2) Debit alice 0.XX 3) Debit alice 3.XX The next time the strand is explored, alice has a USD/XRP offer on the books, and her account is credited: 1) Credit alice 20 When the beginning of the strand is reached, consider what happens when alice is a limiting step. Calculate how much we can get out the step. According to the deferred credit table this is: 12.XX - (5 + 0.XX + 3.XX) This is also limited by alice's balance, which is large thanks to the credit she received in the book step. Now that the step has calculated how much we can get out, throw out the sandbox (the one with the credit), and re-execute. However, the following error occurs. We asked for 12.XX - (5 + 0.XX + 3.XX). However, the ledger has calculated that alice has: ((12.XX - 5) - 0.XX) - 3.XX That's a problem, because that number is smaller. Notice that there are two precision losing operations in the deferred credits table: 1) The 5 + 0.XX step 2) The 12.XX - (total of debits). (Notice total of debits is < 10) However, there is only one precision losing operation in the ledger calculation: 1) (Subtotal of 12.XX-5) - 0.XX That means the calculation for the ledger results in a number that's smaller than the deferred credits. Flow detects this as a re-execution error.
This commit is contained in:
@@ -46,6 +46,7 @@ extern uint256 const featurePayChan;
|
||||
extern uint256 const featureFlow;
|
||||
extern uint256 const featureCryptoConditions;
|
||||
extern uint256 const featureTickSize;
|
||||
extern uint256 const featureRIPD1368;
|
||||
|
||||
} // ripple
|
||||
|
||||
|
||||
Reference in New Issue
Block a user