From 3e27e317270fdc2dd02794fea9da016387699636 Mon Sep 17 00:00:00 2001 From: Antoine Riard Date: Wed, 27 Apr 2022 10:25:22 -0400 Subject: Introduce `mempoolfullrbf` node setting. This new node policy setting enables to accept replaced-by-fee transaction without inspection of the replaceability signaling as described in BIP125 "explicit signaling". If turns on, the node mempool accepts transaction replacement as described in `policy/mempool-replacements.md`. The default setting value is `false`, implying opt-in RBF is enforced. --- test/functional/feature_rbf.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'test') diff --git a/test/functional/feature_rbf.py b/test/functional/feature_rbf.py index 91dc222bab..5558c76138 100755 --- a/test/functional/feature_rbf.py +++ b/test/functional/feature_rbf.py @@ -94,6 +94,9 @@ class ReplaceByFeeTest(BitcoinTestFramework): self.log.info("Running test replacement relay fee...") self.test_replacement_relay_fee() + self.log.info("Running test full replace by fee...") + self.test_fullrbf() + self.log.info("Passed") def make_utxo(self, node, amount, confirmed=True, scriptPubKey=DUMMY_P2WPKH_SCRIPT): @@ -714,5 +717,33 @@ class ReplaceByFeeTest(BitcoinTestFramework): tx.vout[0].nValue -= 1 assert_raises_rpc_error(-26, "insufficient fee", self.nodes[0].sendrawtransaction, tx.serialize().hex()) + def test_fullrbf(self): + txid = self.wallet.send_self_transfer(from_node=self.nodes[0])['txid'] + self.generate(self.nodes[0], 1) + confirmed_utxo = self.wallet.get_utxo(txid=txid) + + self.restart_node(0, extra_args=["-mempoolfullrbf=1"]) + + # Create an explicitly opt-out transaction + optout_tx = self.wallet.send_self_transfer( + from_node=self.nodes[0], + utxo_to_spend=confirmed_utxo, + sequence=SEQUENCE_FINAL, + fee_rate=Decimal('0.01'), + ) + assert_equal(False, self.nodes[0].getmempoolentry(optout_tx['txid'])['bip125-replaceable']) + + conflicting_tx = self.wallet.create_self_transfer( + utxo_to_spend=confirmed_utxo, + sequence=SEQUENCE_FINAL, + fee_rate=Decimal('0.02'), + ) + + # Send the replacement transaction, conflicting with the optout_tx. + self.nodes[0].sendrawtransaction(conflicting_tx['hex'], 0) + + # Optout_tx is not anymore in the mempool. + assert optout_tx['txid'] not in self.nodes[0].getrawmempool() + if __name__ == '__main__': ReplaceByFeeTest().main() -- cgit v1.2.3