Fix some fee logic: (RIPD-614)

* fee_default sets cost in drops of reference transaction
* Offline signing uses fee_default
* Signing multiplier maximum works correctly
* Fix bugs in load fee track
* Remove dead code, add comments
This commit is contained in:
JoelKatz
2014-10-01 11:35:05 -07:00
committed by Nik Bougalis
parent a0dbbb2d84
commit b651e0146d
7 changed files with 28 additions and 24 deletions

View File

@@ -49,6 +49,9 @@ namespace ripple {
#define DEFAULT_FEE_OFFER DEFAULT_FEE_DEFAULT
#define DEFAULT_FEE_OPERATION 1
// Fee in fee units
#define DEFAULT_TRANSACTION_FEE_BASE 10
#define SECTION_DEFAULT_NAME ""
IniFileSections
@@ -323,7 +326,7 @@ Config::Config ()
PEER_PRIVATE = false;
PEERS_MAX = 0; // indicates "use default"
TRANSACTION_FEE_BASE = DEFAULT_FEE_DEFAULT;
TRANSACTION_FEE_BASE = DEFAULT_TRANSACTION_FEE_BASE;
NETWORK_QUORUM = 0; // Don't need to see other nodes
VALIDATION_QUORUM = 1; // Only need one node to vouch

View File

@@ -46,9 +46,9 @@ public:
bool big = (fee > midrange);
if (big) // big fee, divide first to avoid overflow
fee /= baseFee;
fee /= referenceFeeUnits;
else // normal fee, multiply first for accuracy
fee *= referenceFeeUnits;
fee *= baseFee;
std::uint32_t feeFactor = std::max (mLocalTxnLoadFee, mRemoteTxnLoadFee);
@@ -63,9 +63,9 @@ public:
}
if (big) // Fee was big to start, must now multiply
fee *= referenceFeeUnits;
fee *= baseFee;
else // Fee was small to start, mst now divide
fee /= baseFee;
fee /= referenceFeeUnits;
return fee;
}
@@ -73,7 +73,7 @@ public:
// Scale from fee units to millionths of a ripple
std::uint64_t scaleFeeBase (std::uint64_t fee, std::uint64_t baseFee, std::uint32_t referenceFeeUnits)
{
return mulDiv (fee, referenceFeeUnits, baseFee);
return mulDiv (fee, baseFee, referenceFeeUnits);
}
std::uint32_t getRemoteFee ()