From 97f7cc02332d8bc5548c655262c7eeb6f39e40cf Mon Sep 17 00:00:00 2001 From: rkrux Date: Wed, 20 May 2026 16:50:28 +0530 Subject: [PATCH] wallet: mark -walletrbf startup option as deprecated All transactions are by default replaceable since v28, the wallet need not have a configuration option to opt into RBF signalling because it seems redundant now. Emit a warning if this option is used. --- src/wallet/init.cpp | 2 +- src/wallet/wallet.cpp | 6 +++++- test/functional/test_framework/wallet_util.py | 2 ++ test/functional/wallet_backwards_compatibility.py | 5 ++--- test/functional/wallet_bumpfee.py | 9 ++++++--- test/functional/wallet_listtransactions.py | 5 ++++- 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index ccd82e7a7d7..d21da2a58b8 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -74,7 +74,7 @@ void WalletInit::AddWalletOptions(ArgsManager& argsman) const #if HAVE_SYSTEM argsman.AddArg("-walletnotify=", "Execute command when a wallet transaction changes. %s in cmd is replaced by TxID, %w is replaced by wallet name, %b is replaced by the hash of the block including the transaction (set to 'unconfirmed' if the transaction is not included) and %h is replaced by the block height (-1 if not included). %w is not currently implemented on windows. On systems where %w is supported, it should NOT be quoted because this would break shell escaping used to invoke the command.", ArgsManager::ALLOW_ANY, OptionsCategory::WALLET); #endif - argsman.AddArg("-walletrbf", strprintf("Send transactions with full-RBF opt-in enabled (RPC only, default: %u)", DEFAULT_WALLET_RBF), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET); + argsman.AddArg("-walletrbf", strprintf("(DEPRECATED) Send transactions with full-RBF opt-in enabled (RPC only, default: %u)", DEFAULT_WALLET_RBF), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET); argsman.AddArg("-unsafesqlitesync", "Set SQLite synchronous=OFF to disable waiting for the database to sync to disk. This is unsafe and can cause data loss and corruption. This option is only used by tests to improve their performance (default: false)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::WALLET_DEBUG_TEST); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 7cfe6102ecf..ea261bd2600 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3102,7 +3102,11 @@ bool CWallet::LoadWalletArgs(std::shared_ptr wallet, const WalletContex wallet->m_confirm_target = args.GetIntArg("-txconfirmtarget", DEFAULT_TX_CONFIRM_TARGET); wallet->m_spend_zero_conf_change = args.GetBoolArg("-spendzeroconfchange", DEFAULT_SPEND_ZEROCONF_CHANGE); - wallet->m_signal_rbf = args.GetBoolArg("-walletrbf", DEFAULT_WALLET_RBF); + wallet->m_signal_rbf = DEFAULT_WALLET_RBF; + if (args.IsArgSet("-walletrbf")) { + warnings.push_back(_("-walletrbf is deprecated and will be fully removed in the next release.")); + wallet->m_signal_rbf = args.GetBoolArg("-walletrbf").value(); + } wallet->m_keypool_size = std::max(args.GetIntArg("-keypool", DEFAULT_KEYPOOL_SIZE), int64_t{1}); wallet->m_notify_tx_changed_script = args.GetArg("-walletnotify", ""); diff --git a/test/functional/test_framework/wallet_util.py b/test/functional/test_framework/wallet_util.py index 12251530786..18095a3b14a 100755 --- a/test/functional/test_framework/wallet_util.py +++ b/test/functional/test_framework/wallet_util.py @@ -24,6 +24,8 @@ from test_framework.script_util import ( script_to_p2sh_script, ) +WALLETRBF_DEPRECATION_WARNING = "Warning: -walletrbf is deprecated and will be fully removed in the next release." + Key = namedtuple('Key', ['privkey', 'pubkey', 'p2pkh_script', diff --git a/test/functional/wallet_backwards_compatibility.py b/test/functional/wallet_backwards_compatibility.py index f00f2958d12..b2a74893306 100755 --- a/test/functional/wallet_backwards_compatibility.py +++ b/test/functional/wallet_backwards_compatibility.py @@ -28,6 +28,7 @@ from test_framework.util import ( assert_greater_than, assert_raises_rpc_error, ) +from test_framework.wallet_util import WALLETRBF_DEPRECATION_WARNING LAST_KEYPOOL_INDEX = 9 # Index of the last derived address with the keypool size of 10 @@ -349,9 +350,7 @@ class BackwardsCompatibilityTest(BitcoinTestFramework): # Restore the wallet to master load_res = node_master.restorewallet(wallet_name, backup_path) - - # There should be no warnings - assert "warnings" not in load_res + assert_equal(load_res["warnings"], [WALLETRBF_DEPRECATION_WARNING[9:]]) wallet = node_master.get_wallet_rpc(wallet_name) info = wallet.getaddressinfo(address) diff --git a/test/functional/wallet_bumpfee.py b/test/functional/wallet_bumpfee.py index 961f1a1494f..992f63ad423 100755 --- a/test/functional/wallet_bumpfee.py +++ b/test/functional/wallet_bumpfee.py @@ -32,6 +32,7 @@ from test_framework.util import ( find_vout_for_address, ) from test_framework.wallet import MiniWallet +from test_framework.wallet_util import WALLETRBF_DEPRECATION_WARNING WALLET_PASSPHRASE = "test" @@ -116,6 +117,8 @@ class BumpFeeTest(BitcoinTestFramework): test_feerate_checks_replaced_outputs(self, rbf_node, peer_node) test_bumpfee_with_feerate_ignores_walletincrementalrelayfee(self, rbf_node, peer_node) + self.restart_node(1, [], expected_stderr=WALLETRBF_DEPRECATION_WARNING) + def test_invalid_parameters(self, rbf_node, peer_node, dest_address): self.log.info('Test invalid parameters') rbfid = spend_one_input(rbf_node, dest_address) @@ -460,7 +463,7 @@ def test_bumpfee_with_abandoned_descendant_succeeds(self, rbf_node, rbf_node_add assert bumped_result['txid'] in rbf_node.getrawmempool() assert parent_id not in rbf_node.getrawmempool() # Cleanup - self.restart_node(1, self.extra_args[1]) + self.restart_node(1, self.extra_args[1], expected_stderr=WALLETRBF_DEPRECATION_WARNING) rbf_node.walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT) self.connect_nodes(1, 0) self.clear_mempool() @@ -535,11 +538,11 @@ def test_maxtxfee_fails(self, rbf_node, dest_address): # size of bumped transaction (p2wpkh, 1 input, 2 outputs): 141 vbytes # expected bump fee of 141 vbytes * 0.00200000 BTC / 1000 vbytes = 0.00002820 BTC # which exceeds maxtxfee and is expected to raise - self.restart_node(1, ['-maxtxfee=0.000025'] + self.extra_args[1]) + self.restart_node(1, ['-maxtxfee=0.000025'] + self.extra_args[1], expected_stderr=WALLETRBF_DEPRECATION_WARNING) rbf_node.walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT) rbfid = spend_one_input(rbf_node, dest_address) assert_raises_rpc_error(-4, "Unable to create transaction. Fee exceeds maximum configured by user (e.g. -maxtxfee, maxfeerate)", rbf_node.bumpfee, rbfid) - self.restart_node(1, self.extra_args[1]) + self.restart_node(1, self.extra_args[1], expected_stderr=WALLETRBF_DEPRECATION_WARNING) rbf_node.walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT) self.connect_nodes(1, 0) self.clear_mempool() diff --git a/test/functional/wallet_listtransactions.py b/test/functional/wallet_listtransactions.py index 93e8a45b28a..d2bdd9b4295 100755 --- a/test/functional/wallet_listtransactions.py +++ b/test/functional/wallet_listtransactions.py @@ -23,7 +23,7 @@ from test_framework.util import ( assert_raises_rpc_error, find_vout_for_address, ) -from test_framework.wallet_util import get_generate_key +from test_framework.wallet_util import get_generate_key, WALLETRBF_DEPRECATION_WARNING class ListTransactionsTest(BitcoinTestFramework): @@ -104,6 +104,9 @@ class ListTransactionsTest(BitcoinTestFramework): self.test_op_return() self.test_from_me_status_change() + for index, _ in enumerate(self.nodes): + self.stop_node(index, expected_stderr=WALLETRBF_DEPRECATION_WARNING) + def run_rbf_opt_in_test(self): """Test the opt-in-rbf flag for sent and received transactions."""