wallet, test: remove -walletrbf startup option from wallet_listtransactions.py

The corresponding test case that tests for optin rbf variations can also
be removed.
This commit is contained in:
rkrux
2026-05-26 16:15:39 +05:30
parent 0ee94b2fef
commit 8cb6e405d8

View File

@@ -11,10 +11,6 @@ import shutil
from test_framework.blocktools import MAX_FUTURE_BLOCK_TIME
from test_framework.descriptors import descsum_create
from test_framework.messages import (
COIN,
tx_from_hex,
)
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_not_equal,
@@ -23,7 +19,7 @@ from test_framework.util import (
assert_raises_rpc_error,
find_vout_for_address,
)
from test_framework.wallet_util import get_generate_key, WALLETRBF_DEPRECATION_WARNING
from test_framework.wallet_util import get_generate_key
class ListTransactionsTest(BitcoinTestFramework):
@@ -31,7 +27,6 @@ class ListTransactionsTest(BitcoinTestFramework):
self.num_nodes = 3
# whitelist peers to speed up tx relay / mempool sync
self.noban_tx_relay = True
self.extra_args = [["-walletrbf=0"]] * self.num_nodes
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
@@ -97,91 +92,12 @@ class ListTransactionsTest(BitcoinTestFramework):
{"category": "receive", "amount": Decimal("0.44")},
{"txid": txid})
self.run_rbf_opt_in_test()
self.run_externally_generated_address_test()
self.run_coinjoin_test()
self.run_invalid_parameters_test()
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."""
def is_opt_in(node, txid):
"""Check whether a transaction signals opt-in RBF itself."""
rawtx = node.getrawtransaction(txid, 1)
for x in rawtx["vin"]:
if x["sequence"] < 0xfffffffe:
return True
return False
def get_unconfirmed_utxo_entry(node, txid_to_match):
"""Find an unconfirmed output matching a certain txid."""
utxo = node.listunspent(0, 0)
for i in utxo:
if i["txid"] == txid_to_match:
return i
return None
self.log.info("Test txs w/o opt-in RBF")
# Chain a few transactions that don't opt in.
txid_1 = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 1)
assert not is_opt_in(self.nodes[0], txid_1)
self.sync_mempools()
# Tx2 will build off tx1, still not opting in to RBF.
utxo_to_use = get_unconfirmed_utxo_entry(self.nodes[0], txid_1)
assert_equal(utxo_to_use["safe"], True)
utxo_to_use = get_unconfirmed_utxo_entry(self.nodes[1], txid_1)
assert_equal(utxo_to_use["safe"], False)
# Create tx2 using createrawtransaction
inputs = [{"txid": utxo_to_use["txid"], "vout": utxo_to_use["vout"]}]
outputs = {self.nodes[0].getnewaddress(): 0.999}
tx2 = self.nodes[1].createrawtransaction(inputs=inputs, outputs=outputs, replaceable=False)
tx2_signed = self.nodes[1].signrawtransactionwithwallet(tx2)["hex"]
txid_2 = self.nodes[1].sendrawtransaction(tx2_signed)
# ...and check the result
assert not is_opt_in(self.nodes[1], txid_2)
self.sync_mempools()
self.log.info("Test txs with opt-in RBF")
# Tx3 will opt-in to RBF
utxo_to_use = get_unconfirmed_utxo_entry(self.nodes[0], txid_2)
inputs = [{"txid": txid_2, "vout": utxo_to_use["vout"]}]
outputs = {self.nodes[1].getnewaddress(): 0.998}
tx3 = self.nodes[0].createrawtransaction(inputs, outputs)
tx3_modified = tx_from_hex(tx3)
tx3_modified.vin[0].nSequence = 0
tx3 = tx3_modified.serialize().hex()
tx3_signed = self.nodes[0].signrawtransactionwithwallet(tx3)['hex']
txid_3 = self.nodes[0].sendrawtransaction(tx3_signed)
assert is_opt_in(self.nodes[0], txid_3)
self.sync_mempools()
# Tx4 will chain off tx3. Doesn't signal itself, but depends on one
# that does.
utxo_to_use = get_unconfirmed_utxo_entry(self.nodes[1], txid_3)
inputs = [{"txid": txid_3, "vout": utxo_to_use["vout"]}]
outputs = {self.nodes[0].getnewaddress(): 0.997}
tx4 = self.nodes[1].createrawtransaction(inputs=inputs, outputs=outputs, replaceable=False)
tx4_signed = self.nodes[1].signrawtransactionwithwallet(tx4)["hex"]
txid_4 = self.nodes[1].sendrawtransaction(tx4_signed)
assert not is_opt_in(self.nodes[1], txid_4)
self.log.info("Test tx with unknown RBF state")
# Replace tx3, and check that tx4 becomes unknown
tx3_b = tx3_modified
tx3_b.vout[0].nValue -= int(Decimal("0.004") * COIN) # bump the fee
tx3_b = tx3_b.serialize().hex()
tx3_b_signed = self.nodes[0].signrawtransactionwithwallet(tx3_b)['hex']
txid_3b = self.nodes[0].sendrawtransaction(tx3_b_signed, 0)
assert is_opt_in(self.nodes[0], txid_3b)
def run_externally_generated_address_test(self):
"""Test behavior when receiving address is not in the address book."""