@@ -62,13 +62,14 @@ def make_utxo(node, amount, confirmed=True, scriptPubKey=CScript([1])):
62
62
class ReplaceByFeeTest (BitcoinTestFramework ):
63
63
64
64
def set_test_params (self ):
65
- self .num_nodes = 1
65
+ self .num_nodes = 2
66
66
self .extra_args = [["-maxorphantx=1000" ,
67
67
"-whitelist=127.0.0.1" ,
68
68
"-limitancestorcount=50" ,
69
69
"-limitancestorsize=101" ,
70
70
"-limitdescendantcount=200" ,
71
- "-limitdescendantsize=101" ]]
71
+ "-limitdescendantsize=101" ],
72
+ ["-mempoolreplacement=0" ]]
72
73
73
74
def run_test (self ):
74
75
make_utxo (self .nodes [0 ], 1 * COIN )
@@ -115,6 +116,8 @@ def test_simple_doublespend(self):
115
116
tx1a_hex = txToHex (tx1a )
116
117
tx1a_txid = self .nodes [0 ].sendrawtransaction (tx1a_hex , True )
117
118
119
+ self .sync_all ([self .nodes ])
120
+
118
121
# Should fail because we haven't changed the fee
119
122
tx1b = CTransaction ()
120
123
tx1b .vin = [CTxIn (tx0_outpoint , nSequence = 0 )]
@@ -123,12 +126,17 @@ def test_simple_doublespend(self):
123
126
124
127
# This will raise an exception due to insufficient fee
125
128
assert_raises_jsonrpc (- 26 , "insufficient fee" , self .nodes [0 ].sendrawtransaction , tx1b_hex , True )
129
+ # This will raise an exception due to transaction replacement being disabled
130
+ assert_raises_jsonrpc (- 26 , "txn-mempool-conflict" , self .nodes [1 ].sendrawtransaction , tx1b_hex , True )
126
131
127
132
# Extra 0.1 BTC fee
128
133
tx1b = CTransaction ()
129
134
tx1b .vin = [CTxIn (tx0_outpoint , nSequence = 0 )]
130
135
tx1b .vout = [CTxOut (int (0.9 * COIN ), CScript ([b'b' ]))]
131
136
tx1b_hex = txToHex (tx1b )
137
+ # Replacement still disabled even with "enough fee"
138
+ assert_raises_jsonrpc (- 26 , "txn-mempool-conflict" , self .nodes [1 ].sendrawtransaction , tx1b_hex , True )
139
+ # Works when enabled
132
140
tx1b_txid = self .nodes [0 ].sendrawtransaction (tx1b_hex , True )
133
141
134
142
mempool = self .nodes [0 ].getrawmempool ()
@@ -138,6 +146,11 @@ def test_simple_doublespend(self):
138
146
139
147
assert_equal (tx1b_hex , self .nodes [0 ].getrawtransaction (tx1b_txid ))
140
148
149
+ # Second node is running mempoolreplacement=0, will not replace originally-seen txn
150
+ mempool = self .nodes [1 ].getrawmempool ()
151
+ assert tx1a_txid in mempool
152
+ assert tx1b_txid not in mempool
153
+
141
154
def test_doublespend_chain (self ):
142
155
"""Doublespend of a long chain"""
143
156
0 commit comments