Remove ::incrementalRelayFee and ::minRelayTxFee globals

This commit is contained in:
MacroFake 2022-07-21 11:40:22 +02:00
parent fa148602e6
commit fa9cba7afb
No known key found for this signature in database
GPG key ID: CE2B75697E69A548
17 changed files with 77 additions and 57 deletions

View file

@ -8,7 +8,12 @@
#include <kernel/mempool_options.h>
#include <chainparams.h>
#include <consensus/amount.h>
#include <logging.h>
#include <policy/feerate.h>
#include <tinyformat.h>
#include <util/error.h>
#include <util/moneystr.h>
#include <util/system.h>
#include <util/translation.h>
@ -39,6 +44,29 @@ std::optional<bilingual_str> ApplyArgsManOptions(const ArgsManager& argsman, con
if (auto hours = argsman.GetIntArg("-mempoolexpiry")) mempool_opts.expiry = std::chrono::hours{*hours};
// incremental relay fee sets the minimum feerate increase necessary for BIP 125 replacement in the mempool
// and the amount the mempool min fee increases above the feerate of txs evicted due to mempool limiting.
if (argsman.IsArgSet("-incrementalrelayfee")) {
if (std::optional<CAmount> inc_relay_fee = ParseMoney(argsman.GetArg("-incrementalrelayfee", ""))) {
mempool_opts.incremental_relay_feerate = CFeeRate{inc_relay_fee.value()};
} else {
return AmountErrMsg("incrementalrelayfee", argsman.GetArg("-incrementalrelayfee", ""));
}
}
if (argsman.IsArgSet("-minrelaytxfee")) {
if (std::optional<CAmount> min_relay_feerate = ParseMoney(argsman.GetArg("-minrelaytxfee", ""))) {
// High fee check is done afterward in CWallet::Create()
mempool_opts.min_relay_feerate = CFeeRate{min_relay_feerate.value()};
} else {
return AmountErrMsg("minrelaytxfee", argsman.GetArg("-minrelaytxfee", ""));
}
} else if (mempool_opts.incremental_relay_feerate > mempool_opts.min_relay_feerate) {
// Allow only setting incremental fee to control both
mempool_opts.min_relay_feerate = mempool_opts.incremental_relay_feerate;
LogPrintf("Increasing minrelaytxfee to %s to match incrementalrelayfee\n", mempool_opts.min_relay_feerate.ToString());
}
mempool_opts.require_standard = !argsman.GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard());
if (!chainparams.IsTestChain() && !mempool_opts.require_standard) {
return strprintf(Untranslated("acceptnonstdtxn is not currently supported for %s chain"), chainparams.NetworkIDString());