@@ -178,6 +178,8 @@ def test_mempool_conflict(self):
178
178
assert_equal (alice .listunspent (), [unspents [0 ]])
179
179
assert_equal (alice .getbalance (), 25 )
180
180
181
+ assert_equal (alice .gettransaction (tx1_txid )["mempoolconflicts" ], [tx2_txid ])
182
+
181
183
self .log .info ("Test scenario where a mempool conflict is removed" )
182
184
183
185
# broadcast tx3, replaces tx2 in mempool
@@ -187,6 +189,7 @@ def test_mempool_conflict(self):
187
189
# tx1 is no longer conflicted.
188
190
alice .sendrawtransaction (tx3 )
189
191
192
+ assert_equal (alice .gettransaction (tx1_txid )["mempoolconflicts" ], [])
190
193
assert tx1_txid not in self .nodes [0 ].getrawmempool ()
191
194
192
195
# now all of alice's outputs should be considered spent
@@ -262,6 +265,10 @@ def test_mempool_and_block_conflicts(self):
262
265
assert tx2_txid in bob .getrawmempool ()
263
266
assert tx1_conflict_txid in bob .getrawmempool ()
264
267
268
+ assert_equal (bob .gettransaction (tx1_txid )["mempoolconflicts" ], [tx1_conflict_txid ])
269
+ assert_equal (bob .gettransaction (tx2_txid )["mempoolconflicts" ], [])
270
+ assert_equal (bob .gettransaction (tx3_txid )["mempoolconflicts" ], [tx1_conflict_txid ])
271
+
265
272
# check that tx3 is now conflicted, so the output from tx2 can now be spent
266
273
assert_equal (bob .getbalances ()["mine" ]["untrusted_pending" ], Decimal ("24.99990000" ))
267
274
@@ -348,6 +355,8 @@ def test_descendants_with_mempool_conflicts(self):
348
355
assert_equal (alice .getbalance (), 25 )
349
356
assert_equal (bob .getbalances ()["mine" ]["untrusted_pending" ], Decimal ("24.99990000" ))
350
357
358
+ assert_equal (bob .gettransaction (tx1_txid )["mempoolconflicts" ], [])
359
+
351
360
raw_tx = bob .createrawtransaction (inputs = [bob .listunspent (minconf = 0 )[0 ]], outputs = [{carol .getnewaddress () : 24.999 }])
352
361
# Bob creates a child to tx1
353
362
tx1_child = bob .signrawtransactionwithwallet (raw_tx )['hex' ]
@@ -356,6 +365,8 @@ def test_descendants_with_mempool_conflicts(self):
356
365
self .sync_mempools ()
357
366
358
367
# Currently neither tx1 nor tx1_child should have any conflicts
368
+ assert_equal (bob .gettransaction (tx1_txid )["mempoolconflicts" ], [])
369
+ assert_equal (bob .gettransaction (tx1_child_txid )["mempoolconflicts" ], [])
359
370
assert tx1_txid in bob .getrawmempool ()
360
371
assert tx1_child_txid in bob .getrawmempool ()
361
372
assert_equal (len (bob .getrawmempool ()), 2 )
@@ -378,13 +389,21 @@ def test_descendants_with_mempool_conflicts(self):
378
389
assert tx1_conflict_txid in bob .getrawmempool ()
379
390
assert_equal (len (bob .getrawmempool ()), 1 )
380
391
392
+ # Now both tx1 and tx1_child are conflicted by tx1_conflict
393
+ assert_equal (bob .gettransaction (tx1_txid )["mempoolconflicts" ], [tx1_conflict_txid ])
394
+ assert_equal (bob .gettransaction (tx1_child_txid )["mempoolconflicts" ], [tx1_conflict_txid ])
395
+
381
396
# Now create a conflict to tx1_conflict, so that it gets kicked out of the mempool
382
397
raw_tx = alice .createrawtransaction (inputs = [unspents [1 ]], outputs = [{carol .getnewaddress () : 24.9895 }])
383
398
tx1_conflict_conflict = alice .signrawtransactionwithwallet (raw_tx )['hex' ]
384
399
tx1_conflict_conflict_txid = alice .sendrawtransaction (tx1_conflict_conflict )
385
400
386
401
self .sync_mempools ()
387
402
403
+ # Now that tx1_conflict has been removed, both tx1 and tx1_child
404
+ assert_equal (bob .gettransaction (tx1_txid )["mempoolconflicts" ], [])
405
+ assert_equal (bob .gettransaction (tx1_child_txid )["mempoolconflicts" ], [])
406
+
388
407
# Both tx1 and tx1_child are still not in the mempool because they have not be re-broadcasted
389
408
assert tx1_txid not in bob .getrawmempool ()
390
409
assert tx1_child_txid not in bob .getrawmempool ()
0 commit comments