@@ -178,6 +178,8 @@ def test_mempool_conflict(self):
178178 assert_equal (alice .listunspent (), [unspents [0 ]])
179179 assert_equal (alice .getbalance (), 25 )
180180
181+ assert_equal (alice .gettransaction (tx1_txid )["mempoolconflicts" ], [tx2_txid ])
182+
181183 self .log .info ("Test scenario where a mempool conflict is removed" )
182184
183185 # broadcast tx3, replaces tx2 in mempool
@@ -187,6 +189,7 @@ def test_mempool_conflict(self):
187189 # tx1 is no longer conflicted.
188190 alice .sendrawtransaction (tx3 )
189191
192+ assert_equal (alice .gettransaction (tx1_txid )["mempoolconflicts" ], [])
190193 assert tx1_txid not in self .nodes [0 ].getrawmempool ()
191194
192195 # now all of alice's outputs should be considered spent
@@ -262,6 +265,10 @@ def test_mempool_and_block_conflicts(self):
262265 assert tx2_txid in bob .getrawmempool ()
263266 assert tx1_conflict_txid in bob .getrawmempool ()
264267
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+
265272 # check that tx3 is now conflicted, so the output from tx2 can now be spent
266273 assert_equal (bob .getbalances ()["mine" ]["untrusted_pending" ], Decimal ("24.99990000" ))
267274
@@ -348,6 +355,8 @@ def test_descendants_with_mempool_conflicts(self):
348355 assert_equal (alice .getbalance (), 25 )
349356 assert_equal (bob .getbalances ()["mine" ]["untrusted_pending" ], Decimal ("24.99990000" ))
350357
358+ assert_equal (bob .gettransaction (tx1_txid )["mempoolconflicts" ], [])
359+
351360 raw_tx = bob .createrawtransaction (inputs = [bob .listunspent (minconf = 0 )[0 ]], outputs = [{carol .getnewaddress () : 24.999 }])
352361 # Bob creates a child to tx1
353362 tx1_child = bob .signrawtransactionwithwallet (raw_tx )['hex' ]
@@ -356,6 +365,8 @@ def test_descendants_with_mempool_conflicts(self):
356365 self .sync_mempools ()
357366
358367 # 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" ], [])
359370 assert tx1_txid in bob .getrawmempool ()
360371 assert tx1_child_txid in bob .getrawmempool ()
361372 assert_equal (len (bob .getrawmempool ()), 2 )
@@ -378,13 +389,21 @@ def test_descendants_with_mempool_conflicts(self):
378389 assert tx1_conflict_txid in bob .getrawmempool ()
379390 assert_equal (len (bob .getrawmempool ()), 1 )
380391
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+
381396 # Now create a conflict to tx1_conflict, so that it gets kicked out of the mempool
382397 raw_tx = alice .createrawtransaction (inputs = [unspents [1 ]], outputs = [{carol .getnewaddress () : 24.9895 }])
383398 tx1_conflict_conflict = alice .signrawtransactionwithwallet (raw_tx )['hex' ]
384399 tx1_conflict_conflict_txid = alice .sendrawtransaction (tx1_conflict_conflict )
385400
386401 self .sync_mempools ()
387402
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+
388407 # Both tx1 and tx1_child are still not in the mempool because they have not be re-broadcasted
389408 assert tx1_txid not in bob .getrawmempool ()
390409 assert tx1_child_txid not in bob .getrawmempool ()
0 commit comments