diff --git a/doc/release-notes-28354.md b/doc/release-notes-28354.md new file mode 100644 index 00000000000..03d421eb426 --- /dev/null +++ b/doc/release-notes-28354.md @@ -0,0 +1,6 @@ +Tests +----- + +- Non-standard transactions are now disabled by default on testnet + for relay and mempool acceptance. The previous behaviour can be + re-enabled by setting `-acceptnonstdtxn=1`. (#28354) diff --git a/src/init.cpp b/src/init.cpp index 616883c3a14..47cffdd335e 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -585,7 +585,7 @@ void SetupServerArgs(ArgsManager& argsman) SetupChainParamsBaseOptions(argsman); - argsman.AddArg("-acceptnonstdtxn", strprintf("Relay and mine \"non-standard\" transactions (%sdefault: %u)", "testnet/regtest only; ", !testnetChainParams->RequireStandard()), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::NODE_RELAY); + argsman.AddArg("-acceptnonstdtxn", strprintf("Relay and mine \"non-standard\" transactions (test networks only; default: %u)", DEFAULT_ACCEPT_NON_STD_TXN), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::NODE_RELAY); argsman.AddArg("-incrementalrelayfee=", strprintf("Fee rate (in %s/kvB) used to define cost of relay, used for mempool limiting and replacement policy. (default: %s)", CURRENCY_UNIT, FormatMoney(DEFAULT_INCREMENTAL_RELAY_FEE)), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::NODE_RELAY); argsman.AddArg("-dustrelayfee=", strprintf("Fee rate (in %s/kvB) used to define dust, the value of an output such that it will cost more than its value in fees at this fee rate to spend it. (default: %s)", CURRENCY_UNIT, FormatMoney(DUST_RELAY_TX_FEE)), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::NODE_RELAY); argsman.AddArg("-acceptstalefeeestimates", strprintf("Read fee estimates even if they are stale (%sdefault: %u) fee estimates are considered stale if they are %s hours old", "regtest only; ", DEFAULT_ACCEPT_STALE_FEE_ESTIMATES, Ticks(MAX_FILE_AGE)), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST); diff --git a/src/kernel/chainparams.cpp b/src/kernel/chainparams.cpp index d9ed1547b36..733a3339b38 100644 --- a/src/kernel/chainparams.cpp +++ b/src/kernel/chainparams.cpp @@ -151,7 +151,6 @@ public: vFixedSeeds = std::vector(std::begin(chainparams_seed_main), std::end(chainparams_seed_main)); fDefaultConsistencyChecks = false; - fRequireStandard = true; m_is_test_chain = false; m_is_mockable_chain = false; @@ -259,7 +258,6 @@ public: vFixedSeeds = std::vector(std::begin(chainparams_seed_test), std::end(chainparams_seed_test)); fDefaultConsistencyChecks = false; - fRequireStandard = false; m_is_test_chain = true; m_is_mockable_chain = false; @@ -382,7 +380,6 @@ public: bech32_hrp = "tb"; fDefaultConsistencyChecks = false; - fRequireStandard = true; m_is_test_chain = true; m_is_mockable_chain = false; } @@ -474,7 +471,6 @@ public: vSeeds.emplace_back("dummySeed.invalid."); fDefaultConsistencyChecks = true; - fRequireStandard = true; m_is_test_chain = true; m_is_mockable_chain = true; diff --git a/src/kernel/chainparams.h b/src/kernel/chainparams.h index ad0b49a885d..2d38af609c9 100644 --- a/src/kernel/chainparams.h +++ b/src/kernel/chainparams.h @@ -102,8 +102,6 @@ public: const CBlock& GenesisBlock() const { return genesis; } /** Default value for -checkmempool and -checkblockindex argument */ bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; } - /** Policy: Filter transactions that do not match well-defined patterns */ - bool RequireStandard() const { return fRequireStandard; } /** If this chain is exclusively used for testing */ bool IsTestChain() const { return m_is_test_chain; } /** If this chain allows time to be mocked */ @@ -179,7 +177,6 @@ protected: CBlock genesis; std::vector vFixedSeeds; bool fDefaultConsistencyChecks; - bool fRequireStandard; bool m_is_test_chain; bool m_is_mockable_chain; CCheckpointData checkpointData; diff --git a/src/kernel/mempool_options.h b/src/kernel/mempool_options.h index 58bb3debbf0..757be41b3c6 100644 --- a/src/kernel/mempool_options.h +++ b/src/kernel/mempool_options.h @@ -23,6 +23,8 @@ static constexpr unsigned int DEFAULT_BLOCKSONLY_MAX_MEMPOOL_SIZE_MB{5}; static constexpr unsigned int DEFAULT_MEMPOOL_EXPIRY_HOURS{336}; /** Default for -mempoolfullrbf, if the transaction replaceability signaling is ignored */ static constexpr bool DEFAULT_MEMPOOL_FULL_RBF{false}; +/** Default for -acceptnonstdtxn */ +static constexpr bool DEFAULT_ACCEPT_NON_STD_TXN{false}; namespace kernel { /** diff --git a/src/node/mempool_args.cpp b/src/node/mempool_args.cpp index 7d8244980d1..f63d9875fc0 100644 --- a/src/node/mempool_args.cpp +++ b/src/node/mempool_args.cpp @@ -86,7 +86,7 @@ util::Result ApplyArgsManOptions(const ArgsManager& argsman, const CChainP mempool_opts.max_datacarrier_bytes = std::nullopt; } - mempool_opts.require_standard = !argsman.GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard()); + mempool_opts.require_standard = !argsman.GetBoolArg("-acceptnonstdtxn", DEFAULT_ACCEPT_NON_STD_TXN); if (!chainparams.IsTestChain() && !mempool_opts.require_standard) { return util::Error{strprintf(Untranslated("acceptnonstdtxn is not currently supported for %s chain"), chainparams.GetChainTypeString())}; }