From 1384dbaf6d0bfcdb05f97e1e3cb3d5e498bee505 Mon Sep 17 00:00:00 2001 From: glozow Date: Wed, 23 Jul 2025 13:49:22 -0400 Subject: [PATCH] [config] emit warning for -maxorphantx, but allow it to be set --- src/init.cpp | 7 +++++++ test/functional/p2p_orphan_handling.py | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/init.cpp b/src/init.cpp index 63244c802ea..ac4c3f73f1c 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -490,6 +490,8 @@ void SetupServerArgs(ArgsManager& argsman, bool can_listen_ipc) argsman.AddArg("-allowignoredconf", strprintf("For backwards compatibility, treat an unused %s file in the datadir as a warning, not an error.", BITCOIN_CONF_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-loadblock=", "Imports blocks from external file on startup", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-maxmempool=", strprintf("Keep the transaction memory pool below megabytes (default: %u)", DEFAULT_MAX_MEMPOOL_SIZE_MB), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); + // TODO: remove in v31.0 + argsman.AddArg("-maxorphantx=", strprintf("(Removed option, see release notes)"), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-mempoolexpiry=", strprintf("Do not keep transactions in the mempool longer than hours (default: %u)", DEFAULT_MEMPOOL_EXPIRY_HOURS), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-minimumchainwork=", strprintf("Minimum work assumed to exist on a valid chain in hex (default: %s, testnet3: %s, testnet4: %s, signet: %s)", defaultChainParams->GetConsensus().nMinimumChainWork.GetHex(), testnetChainParams->GetConsensus().nMinimumChainWork.GetHex(), testnet4ChainParams->GetConsensus().nMinimumChainWork.GetHex(), signetChainParams->GetConsensus().nMinimumChainWork.GetHex()), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS); argsman.AddArg("-par=", strprintf("Set the number of script verification threads (0 = auto, up to %d, <0 = leave that many cores free, default: %d)", @@ -893,6 +895,11 @@ bool AppInitParameterInteraction(const ArgsManager& args) InitWarning(_("Options '-datacarrier' or '-datacarriersize' are set but are marked as deprecated. They will be removed in a future version.")); } + // We no longer limit the orphanage based on number of transactions but keep the option to warn users who still have it in their config. + if (args.IsArgSet("-maxorphantx")) { + InitWarning(_("Option '-maxorphantx' is set but no longer has any effect (see release notes). Please remove it from your configuration.")); + } + // Error if network-specific options (-addnode, -connect, etc) are // specified in default section of config file, but not overridden // on the command line or in this chain's section of the config file. diff --git a/test/functional/p2p_orphan_handling.py b/test/functional/p2p_orphan_handling.py index ddaa8ac0ac9..f2eed48603c 100755 --- a/test/functional/p2p_orphan_handling.py +++ b/test/functional/p2p_orphan_handling.py @@ -830,6 +830,16 @@ class OrphanHandlingTest(BitcoinTestFramework): assert orphan["txid"] in final_mempool assert tx_replacer_C["txid"] in final_mempool + @cleanup + def test_maxorphantx_option(self): + # This test should be removed when -maxorphantx is removed. + self.log.info("Test that setting the -maxorphantx option does not error") + warning = "Warning: Option '-maxorphantx' is set but no longer has any effect (see release notes). Please remove it from your configuration." + self.restart_node(0, extra_args=["-maxorphantx=5"]) + assert_equal(self.nodes[0].getorphantxs(), []) + self.stop_node(0, expected_stderr=warning) + self.restart_node(0) + def run_test(self): self.nodes[0].setmocktime(int(time.time())) self.wallet_nonsegwit = MiniWallet(self.nodes[0], mode=MiniWalletMode.RAW_P2PK) @@ -850,6 +860,7 @@ class OrphanHandlingTest(BitcoinTestFramework): self.test_announcers_before_and_after() self.test_parents_change() self.test_maximal_package_protected() + self.test_maxorphantx_option() if __name__ == '__main__':