mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user