mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +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:
@@ -547,7 +547,10 @@ class AccountTx_test : public beast::unit_test::suite
|
||||
|
||||
// All it takes is a large enough XRP payment to resurrect
|
||||
// becky's account. Try too small a payment.
|
||||
env(pay(alice, becky, XRP(9)), ter(tecNO_DST_INSUF_XRP));
|
||||
env(pay(alice,
|
||||
becky,
|
||||
drops(env.current()->fees().accountReserve(0)) - XRP(1)),
|
||||
ter(tecNO_DST_INSUF_XRP));
|
||||
env.close();
|
||||
|
||||
// Actually resurrect becky's account.
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <ripple/app/misc/NetworkOPs.h>
|
||||
#include <ripple/beast/unit_test.h>
|
||||
#include <ripple/core/ConfigSections.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <test/jtx.h>
|
||||
#include <test/jtx/WSClient.h>
|
||||
@@ -326,11 +327,11 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
testValidations()
|
||||
testValidations(FeatureBitset features)
|
||||
{
|
||||
using namespace jtx;
|
||||
|
||||
Env env{*this, envconfig(validator, "")};
|
||||
Env env{*this, envconfig(validator, ""), features};
|
||||
auto& cfg = env.app().config();
|
||||
if (!BEAST_EXPECT(cfg.section(SECTION_VALIDATION_SEED).empty()))
|
||||
return;
|
||||
@@ -410,10 +411,25 @@ public:
|
||||
if (jv.isMember(jss::server_version) != isFlagLedger)
|
||||
return false;
|
||||
|
||||
if (jv.isMember(jss::reserve_base) != isFlagLedger)
|
||||
bool xrpFees = env.closed()->rules().enabled(featureXRPFees);
|
||||
if ((!xrpFees &&
|
||||
jv.isMember(jss::reserve_base) != isFlagLedger) ||
|
||||
(xrpFees && jv.isMember(jss::reserve_base)))
|
||||
return false;
|
||||
|
||||
if (jv.isMember(jss::reserve_inc) != isFlagLedger)
|
||||
if ((!xrpFees &&
|
||||
jv.isMember(jss::reserve_inc) != isFlagLedger) ||
|
||||
(xrpFees && jv.isMember(jss::reserve_inc)))
|
||||
return false;
|
||||
|
||||
if ((xrpFees &&
|
||||
jv.isMember(jss::reserve_base_drops) != isFlagLedger) ||
|
||||
(!xrpFees && jv.isMember(jss::reserve_base_drops)))
|
||||
return false;
|
||||
|
||||
if ((xrpFees &&
|
||||
jv.isMember(jss::reserve_inc_drops) != isFlagLedger) ||
|
||||
(!xrpFees && jv.isMember(jss::reserve_inc_drops)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -1140,11 +1156,16 @@ public:
|
||||
void
|
||||
run() override
|
||||
{
|
||||
using namespace test::jtx;
|
||||
FeatureBitset const all{supported_amendments()};
|
||||
FeatureBitset const xrpFees{featureXRPFees};
|
||||
|
||||
testServer();
|
||||
testLedger();
|
||||
testTransactions();
|
||||
testManifests();
|
||||
testValidations();
|
||||
testValidations(all - xrpFees);
|
||||
testValidations(all);
|
||||
testSubErrors(true);
|
||||
testSubErrors(false);
|
||||
testSubByUrl();
|
||||
|
||||
Reference in New Issue
Block a user