QA: feature_rbf: Check opt-in RBF with TRUC signal

This commit is contained in:
Luke Dashjr 2024-06-05 00:16:22 +00:00
parent 3dbae62c64
commit 0b272c39d8

View File

@ -34,6 +34,8 @@ class ReplaceByFeeTest(BitcoinTestFramework):
"-limitancestorsize=101",
"-limitdescendantcount=200",
"-limitdescendantsize=101",
"-mempooltruc=accept",
"-paytxfee=0.00001", # this test confuses the fee estimator into nearly 1 BTC fees
],
# second node has default mempool parameters, besides mempoolfullrbf being disabled
[
@ -99,8 +101,10 @@ class ReplaceByFeeTest(BitcoinTestFramework):
self.log.info("Running test opt-in...")
self.test_opt_in(fullrbf=False)
self.test_opt_in(fullrbf=False, use_truc=True)
self.nodes[0], self.nodes[-1] = self.nodes[-1], self.nodes[0]
self.test_opt_in(fullrbf=True)
self.test_opt_in(fullrbf=True, use_truc=True)
self.nodes[0], self.nodes[-1] = self.nodes[-1], self.nodes[0]
self.log.info("Running test RPC...")
@ -513,7 +517,7 @@ class ReplaceByFeeTest(BitcoinTestFramework):
self.generate(normal_node, 1)
self.wallet.rescan_utxos()
def test_opt_in(self, fullrbf):
def test_opt_in(self, fullrbf, use_truc=False):
"""Replacing should only work if orig tx opted in"""
tx0_outpoint = self.make_utxo(self.nodes[0], int(1.1 * COIN))
@ -572,15 +576,24 @@ class ReplaceByFeeTest(BitcoinTestFramework):
# opt-in on one of the inputs
# Transaction should be replaceable on either input
self.generate(self.nodes[0], 1) # clean mempool so parent txs don't trigger BIP125
if use_truc:
kwargs = {'sequence': SEQUENCE_FINAL, 'version': 3}
else:
kwargs = {'sequence': [SEQUENCE_FINAL, 0xfffffffd]}
tx3a_txid = self.wallet.send_self_transfer_multi(
from_node=self.nodes[0],
utxos_to_spend=[tx1a_utxo, tx2a_utxo],
sequence=[SEQUENCE_FINAL, 0xfffffffd],
fee_per_output=int(0.1 * COIN),
**kwargs
)["txid"]
# This transaction is shown as replaceable
assert_equal(self.nodes[0].getmempoolentry(tx3a_txid)['bip125-replaceable'], True)
if use_truc:
assert_equal(self.nodes[0].getmempoolentry(tx3a_txid)['bip125-replaceable'], False)
else:
assert_equal(self.nodes[0].getmempoolentry(tx3a_txid)['bip125-replaceable'], True)
self.wallet.send_self_transfer(
from_node=self.nodes[0],