From 6173ca37cd561fb8efd7d02f64b00379d112a0b4 Mon Sep 17 00:00:00 2001 From: Patrick Lodder Date: Sun, 10 Oct 2021 01:16:28 +0200 Subject: [PATCH] Remove dustRelayFee as it is no longer used DustRelayFee (-dustrelayfee) was used sporadically throughout the code, even though it had been disabled for dust determination, but has now completely been removed from all dust and fee related queries. Therefore, it can be removed from the code. Moves the warning from DUST_RELAY_TX_FEE to DEFAULT_HARD_DUST_LIMIT as it is very relevant for the latter, but never was relevant for the former as it was disabled for us. --- src/init.cpp | 11 ----------- src/policy/policy.cpp | 1 - src/policy/policy.h | 11 +++++------ 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 558726366..cb59200a8 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -473,7 +473,6 @@ std::string HelpMessage(HelpMessageMode mode) if (showDebug) { strUsage += HelpMessageOpt("-acceptnonstdtxn", strprintf("Relay and mine \"non-standard\" transactions (%sdefault: %u)", "testnet/regtest only; ", !Params(CBaseChainParams::TESTNET).RequireStandard())); strUsage += HelpMessageOpt("-incrementalrelayfee=", strprintf("Fee rate (in %s/kB) used to define cost of relay, used for mempool limiting and BIP 125 replacement. (default: %s)", CURRENCY_UNIT, FormatMoney(DEFAULT_INCREMENTAL_RELAY_FEE))); - strUsage += HelpMessageOpt("-dustrelayfee=", strprintf("Fee rate (in %s/kB) used to defined dust, the value of an output such that it will cost about 1/3 of its value in fees at this fee rate to spend it. (default: %s)", CURRENCY_UNIT, FormatMoney(DUST_RELAY_TX_FEE))); } strUsage += HelpMessageOpt("-dustlimit=", strprintf(_("Amount under which a transaction output is considered dust, in %s (default: %s)"), CURRENCY_UNIT, FormatMoney(DEFAULT_DUST_LIMIT))); strUsage += HelpMessageOpt("-harddustlimit=", strprintf(_("Amount under which a transaction output is considered non-standard and will not be accepted or relayed, in %s (default: %s)"), CURRENCY_UNIT, FormatMoney(DEFAULT_HARD_DUST_LIMIT))); @@ -1030,16 +1029,6 @@ bool AppInitParameterInteraction() return InitError(AmountErrMsg("blockmintxfee", GetArg("-blockmintxfee", ""))); } - // Feerate used to define dust. Shouldn't be changed lightly as old - // implementations may inadvertently create non-standard transactions - if (IsArgSet("-dustrelayfee")) - { - CAmount n = 0; - if (!ParseMoney(GetArg("-dustrelayfee", ""), n) || 0 == n) - return InitError(AmountErrMsg("dustrelayfee", GetArg("-dustrelayfee", ""))); - dustRelayFee = CFeeRate(n); - } - fRequireStandard = !GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard()); if (chainparams.RequireStandard() && !fRequireStandard) return InitError(strprintf("acceptnonstdtxn is not currently supported for %s chain", chainparams.NetworkIDString())); diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp index 2c471f2f5..16d0f6fd1 100644 --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -207,7 +207,6 @@ bool IsWitnessStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs) } CFeeRate incrementalRelayFee = CFeeRate(DEFAULT_INCREMENTAL_RELAY_FEE); -CFeeRate dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE); unsigned int nBytesPerSigOp = DEFAULT_BYTES_PER_SIGOP; CAmount nDustLimit = DEFAULT_DUST_LIMIT; CAmount nHardDustLimit = DEFAULT_HARD_DUST_LIMIT; diff --git a/src/policy/policy.h b/src/policy/policy.h index 224e7eb88..4b1b175d5 100644 --- a/src/policy/policy.h +++ b/src/policy/policy.h @@ -61,12 +61,6 @@ static const unsigned int MAX_STANDARD_P2WSH_STACK_ITEMS = 100; static const unsigned int MAX_STANDARD_P2WSH_STACK_ITEM_SIZE = 80; /** The maximum size of a standard witnessScript */ static const unsigned int MAX_STANDARD_P2WSH_SCRIPT_SIZE = 3600; -/** Min feerate for defining dust. Historically this has been the same as the - * minRelayTxFee, however changing the dust limit changes which transactions are - * standard and should be done with care and ideally rarely. It makes sense to - * only increase the dust limit after prior releases were already not creating - * outputs below the new threshold */ -static const CAmount DUST_RELAY_TX_FEE = RECOMMENDED_MIN_TX_FEE / 1000; /** * Dogecoin: Default dust limit that is evaluated when considering whether a * transaction output is required to pay additional fee for relay and inclusion @@ -77,6 +71,11 @@ static const CAmount DEFAULT_DUST_LIMIT = RECOMMENDED_MIN_TX_FEE; * Dogecoin: Default hard dust limit that is evaluated when considering whether * a transaction is standard. Transactions under this limit will not be accepted * to the mempool and thus not relayed. Can be overridden by -harddustlimit + * + * Changing the hard dust limit changes which transactions are standard and + * should be done with care and ideally rarely. It makes sense to only increase + * this limit after prior releases were already not creating outputs below the + * new threshold */ static const CAmount DEFAULT_HARD_DUST_LIMIT = DEFAULT_DUST_LIMIT / 10;