mirror of
https://github.com/Xahau/xahaud.git
synced 2026-06-04 01:06:37 +00:00
XRPFees: Fee setting and handling improvements (#4247)
* Introduces amendment `XRPFees` * Convert fee voting and protocol messages to use XRPAmounts * Includes Validations, Change transactions, the "Fees" ledger object, and subscription messages * Improve handling of 0 drop reference fee with TxQ. For use with networks that do not want to require fees * Note that fee escalation logic is still in place, which may cause the open ledger fee to rise if the network is busy. 0 drop transactions will still queue, and fee escalation can be effectively disabled by modifying the configuration on all nodes * Change default network reserves to match Mainnet * Name the new SFields *Drops (not *XRP) * Reserve SField IDs for Hooks * Clarify comments explaining the ttFEE transaction field validation
This commit is contained in:
@@ -36,55 +36,52 @@ public:
|
||||
Fees const fees = [&]() {
|
||||
Fees f;
|
||||
f.base = d.FEE_DEFAULT;
|
||||
f.units = d.TRANSACTION_FEE_BASE;
|
||||
f.reserve = 200 * DROPS_PER_XRP;
|
||||
f.increment = 50 * DROPS_PER_XRP;
|
||||
return f;
|
||||
}();
|
||||
|
||||
BEAST_EXPECT(
|
||||
scaleFeeLoad(FeeUnit64{0}, l, fees, false) == XRPAmount{0});
|
||||
scaleFeeLoad(XRPAmount{0}, l, fees, false) == XRPAmount{0});
|
||||
BEAST_EXPECT(
|
||||
scaleFeeLoad(FeeUnit64{10000}, l, fees, false) ==
|
||||
scaleFeeLoad(XRPAmount{10000}, l, fees, false) ==
|
||||
XRPAmount{10000});
|
||||
BEAST_EXPECT(
|
||||
scaleFeeLoad(FeeUnit64{1}, l, fees, false) == XRPAmount{1});
|
||||
scaleFeeLoad(XRPAmount{1}, l, fees, false) == XRPAmount{1});
|
||||
}
|
||||
{
|
||||
Fees const fees = [&]() {
|
||||
Fees f;
|
||||
f.base = d.FEE_DEFAULT * 10;
|
||||
f.units = d.TRANSACTION_FEE_BASE;
|
||||
f.reserve = 200 * DROPS_PER_XRP;
|
||||
f.increment = 50 * DROPS_PER_XRP;
|
||||
return f;
|
||||
}();
|
||||
|
||||
BEAST_EXPECT(
|
||||
scaleFeeLoad(FeeUnit64{0}, l, fees, false) == XRPAmount{0});
|
||||
scaleFeeLoad(XRPAmount{0}, l, fees, false) == XRPAmount{0});
|
||||
BEAST_EXPECT(
|
||||
scaleFeeLoad(FeeUnit64{10000}, l, fees, false) ==
|
||||
XRPAmount{100000});
|
||||
scaleFeeLoad(XRPAmount{10000}, l, fees, false) ==
|
||||
XRPAmount{10000});
|
||||
BEAST_EXPECT(
|
||||
scaleFeeLoad(FeeUnit64{1}, l, fees, false) == XRPAmount{10});
|
||||
scaleFeeLoad(XRPAmount{1}, l, fees, false) == XRPAmount{1});
|
||||
}
|
||||
{
|
||||
Fees const fees = [&]() {
|
||||
Fees f;
|
||||
f.base = d.FEE_DEFAULT;
|
||||
f.units = d.TRANSACTION_FEE_BASE * 10;
|
||||
f.reserve = 200 * DROPS_PER_XRP;
|
||||
f.increment = 50 * DROPS_PER_XRP;
|
||||
return f;
|
||||
}();
|
||||
|
||||
BEAST_EXPECT(
|
||||
scaleFeeLoad(FeeUnit64{0}, l, fees, false) == XRPAmount{0});
|
||||
scaleFeeLoad(XRPAmount{0}, l, fees, false) == XRPAmount{0});
|
||||
BEAST_EXPECT(
|
||||
scaleFeeLoad(FeeUnit64{10000}, l, fees, false) ==
|
||||
XRPAmount{1000});
|
||||
scaleFeeLoad(XRPAmount{10000}, l, fees, false) ==
|
||||
XRPAmount{10000});
|
||||
BEAST_EXPECT(
|
||||
scaleFeeLoad(FeeUnit64{1}, l, fees, false) == XRPAmount{0});
|
||||
scaleFeeLoad(XRPAmount{1}, l, fees, false) == XRPAmount{1});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user