aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAntoine Riard <dev@ariard.me>2022-04-27 10:25:22 -0400
committerAntoine Riard <dev@ariard.me>2022-07-06 20:57:29 -0400
commit3e27e317270fdc2dd02794fea9da016387699636 (patch)
tree4ca7453d07febd54f8dff13a8dbf61fbe7b685f0 /test
parent5bc10b39abbcb77638161902ccd1225139bc7cc0 (diff)
downloadbitcoin-3e27e317270fdc2dd02794fea9da016387699636.tar.xz
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.
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/feature_rbf.py31
1 files changed, 31 insertions, 0 deletions
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()