Simplify fee handling during transaction submission:

Avoid custom overflow code; simply use 128-bit math to
maintain precision and return a saturated 64-bit value
as the final result.

Disallow use of negative values in the `fee_mult_max`
and `fee_div_max` fields. This change could potentially
cause submissions with negative values that would have
previously succeeded to now fail.
This commit is contained in:
Nik Bougalis
2017-01-18 03:33:46 -08:00
parent c7de7950c4
commit 8345475bc3
8 changed files with 135 additions and 106 deletions

View File

@@ -42,16 +42,8 @@ public:
return f;
}();
BEAST_EXPECT (scaleFeeBase (10000, fees) == 10000);
BEAST_EXPECT (scaleFeeLoad (10000, l, fees, false) == 10000);
BEAST_EXPECT (scaleFeeBase (1, fees) == 1);
BEAST_EXPECT (scaleFeeLoad (1, l, fees, false) == 1);
// Check new default fee values give same fees as old defaults
BEAST_EXPECT (scaleFeeBase (d.FEE_DEFAULT, fees) == 10);
BEAST_EXPECT (scaleFeeBase (d.FEE_ACCOUNT_RESERVE, fees) == 200 * SYSTEM_CURRENCY_PARTS);
BEAST_EXPECT (scaleFeeBase (d.FEE_OWNER_RESERVE, fees) == 50 * SYSTEM_CURRENCY_PARTS);
BEAST_EXPECT (scaleFeeBase (d.FEE_OFFER, fees) == 10);
}
};