Add units to all fee calculations:

* Uses existing XRPAmount with units for drops, and a new TaggedFee for
  fee units (LoadFeeTrack), and fee levels (TxQ).
* Resolves #2451
This commit is contained in:
Edward Hennis
2019-02-14 18:59:07 -05:00
parent 1901b981f3
commit e3b5b808c5
87 changed files with 2195 additions and 681 deletions

View File

@@ -18,9 +18,11 @@
//==============================================================================
#include <ripple/app/tx/impl/InvariantCheck.h>
#include <ripple/basics/FeeUnits.h>
#include <ripple/basics/Log.h>
#include <ripple/ledger/ReadView.h>
#include <ripple/protocol/Feature.h>
#include <ripple/protocol/SystemParameters.h>
namespace ripple {
@@ -50,7 +52,7 @@ TransactionFeeCheck::finalize(
// We should never charge a fee that's greater than or equal to the
// entire XRP supply.
if (fee.drops() >= SYSTEM_CURRENCY_START)
if (fee >= INITIAL_XRP)
{
JLOG(j.fatal()) << "Invariant failed: fee paid exceeds system limit: " << fee.drops();
return false;
@@ -164,11 +166,11 @@ XRPBalanceChecks::visitEntry(
if (!balance.native())
return true;
auto const drops = balance.xrp().drops();
auto const drops = balance.xrp();
// Can't have more than the number of drops instantiated
// in the genesis ledger.
if (drops > SYSTEM_CURRENCY_START)
if (drops > INITIAL_XRP)
return true;
// Can't have a negative balance (0 is OK)
@@ -260,10 +262,10 @@ NoZeroEscrow::visitEntry(
if (!amount.native())
return true;
if (amount.xrp().drops() <= 0)
if (amount.xrp() <= 0)
return true;
if (amount.xrp().drops() >= SYSTEM_CURRENCY_START)
if (amount.xrp() >= INITIAL_XRP)
return true;
return false;