wallet_deprecated_rbf.py raw

   1  #!/usr/bin/env python3
   2  # Copyright (c) 2026-present The Bitcoin Core developers
   3  # Distributed under the MIT software license, see the accompanying
   4  # file COPYING or http://www.opensource.org/licenses/mit-license.php.
   5  """Test deprecation of RPC calls."""
   6  from test_framework.util import assert_equal
   7  from test_framework.test_framework import BitcoinTestFramework
   8  
   9  '''
  10  This test exercises the deprecatedrpc=bip125 flag and deprecated -walletrbf options
  11  and should be removed when the options are removed post deprecation.
  12  '''
  13  class WalletDeprecatedRBFTest(BitcoinTestFramework):
  14      def set_test_params(self):
  15        self.num_nodes = 1
  16        self.setup_clean_chain = True
  17        self.extra_args = [[]]
  18  
  19      def skip_test_if_missing_module(self):
  20        self.skip_if_no_wallet()
  21  
  22      def run_test(self):
  23        self.log.info("Test -deprecatedrpc=bip125 and -walletrbf startup option")
  24  
  25        self.restart_node(0, extra_args=["-walletrbf=0", "-deprecatedrpc=bip125"])
  26        node = self.nodes[0]
  27        node.createwallet("deprecated_optinrbf")
  28        wallet = node.get_wallet_rpc("deprecated_optinrbf")
  29        self.generatetoaddress(node, nblocks=101, address=wallet.getnewaddress(), sync_fun=self.no_op)
  30        tx = wallet.gettransaction(wallet.sendall(recipients=[wallet.getnewaddress()])["txid"])
  31        assert_equal("bip125-replaceable" in tx, True)
  32        assert_equal(tx["bip125-replaceable"], "no")
  33        self.stop_node(0, expected_stderr="Warning: -walletrbf is deprecated and will be fully removed in the next release.")
  34  
  35  
  36  if __name__ == '__main__':
  37      WalletDeprecatedRBFTest(__file__).main()
  38