Skip to content

Commit 1384dba

Browse files
committed
[config] emit warning for -maxorphantx, but allow it to be set
1 parent b10c55b commit 1384dba

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/init.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,8 @@ void SetupServerArgs(ArgsManager& argsman, bool can_listen_ipc)
490490
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);
491491
argsman.AddArg("-loadblock=<file>", "Imports blocks from external file on startup", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
492492
argsman.AddArg("-maxmempool=<n>", strprintf("Keep the transaction memory pool below <n> megabytes (default: %u)", DEFAULT_MAX_MEMPOOL_SIZE_MB), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
493+
// TODO: remove in v31.0
494+
argsman.AddArg("-maxorphantx=<n>", strprintf("(Removed option, see release notes)"), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
493495
argsman.AddArg("-mempoolexpiry=<n>", strprintf("Do not keep transactions in the mempool longer than <n> hours (default: %u)", DEFAULT_MEMPOOL_EXPIRY_HOURS), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
494496
argsman.AddArg("-minimumchainwork=<hex>", 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);
495497
argsman.AddArg("-par=<n>", 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)
893895
InitWarning(_("Options '-datacarrier' or '-datacarriersize' are set but are marked as deprecated. They will be removed in a future version."));
894896
}
895897

898+
// 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.
899+
if (args.IsArgSet("-maxorphantx")) {
900+
InitWarning(_("Option '-maxorphantx' is set but no longer has any effect (see release notes). Please remove it from your configuration."));
901+
}
902+
896903
// Error if network-specific options (-addnode, -connect, etc) are
897904
// specified in default section of config file, but not overridden
898905
// on the command line or in this chain's section of the config file.

test/functional/p2p_orphan_handling.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,16 @@ def test_parents_change(self):
830830
assert orphan["txid"] in final_mempool
831831
assert tx_replacer_C["txid"] in final_mempool
832832

833+
@cleanup
834+
def test_maxorphantx_option(self):
835+
# This test should be removed when -maxorphantx is removed.
836+
self.log.info("Test that setting the -maxorphantx option does not error")
837+
warning = "Warning: Option '-maxorphantx' is set but no longer has any effect (see release notes). Please remove it from your configuration."
838+
self.restart_node(0, extra_args=["-maxorphantx=5"])
839+
assert_equal(self.nodes[0].getorphantxs(), [])
840+
self.stop_node(0, expected_stderr=warning)
841+
self.restart_node(0)
842+
833843
def run_test(self):
834844
self.nodes[0].setmocktime(int(time.time()))
835845
self.wallet_nonsegwit = MiniWallet(self.nodes[0], mode=MiniWalletMode.RAW_P2PK)
@@ -850,6 +860,7 @@ def run_test(self):
850860
self.test_announcers_before_and_after()
851861
self.test_parents_change()
852862
self.test_maximal_package_protected()
863+
self.test_maxorphantx_option()
853864

854865

855866
if __name__ == '__main__':

0 commit comments

Comments
 (0)