mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-25 21:45:52 +00:00
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.
54 lines
1.8 KiB
C++
54 lines
1.8 KiB
C++
//------------------------------------------------------------------------------
|
|
/*
|
|
This file is part of rippled: https://github.com/ripple/rippled
|
|
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
//==============================================================================
|
|
|
|
#ifndef RIPPLE_PROTOCOL_FEATURE_H_INCLUDED
|
|
#define RIPPLE_PROTOCOL_FEATURE_H_INCLUDED
|
|
|
|
#include <ripple/basics/base_uint.h>
|
|
#include <string>
|
|
|
|
namespace ripple {
|
|
|
|
/** Convert feature description to feature id. */
|
|
/** @{ */
|
|
uint256
|
|
feature (std::string const& name);
|
|
|
|
uint256
|
|
feature (const char* name);
|
|
/** @} */
|
|
|
|
extern uint256 const featureMultiSign;
|
|
extern uint256 const featureTickets;
|
|
extern uint256 const featureSusPay;
|
|
extern uint256 const featureTrustSetAuth;
|
|
extern uint256 const featureFeeEscalation;
|
|
extern uint256 const featureOwnerPaysFee;
|
|
extern uint256 const featureCompareFlowV1V2;
|
|
extern uint256 const featureSHAMapV2;
|
|
extern uint256 const featurePayChan;
|
|
extern uint256 const featureFlow;
|
|
extern uint256 const featureCryptoConditions;
|
|
extern uint256 const featureTickSize;
|
|
extern uint256 const featureRIPD1368;
|
|
|
|
} // ripple
|
|
|
|
#endif
|