@@ -231,6 +231,7 @@ def test_orphan_rejected_parents_exceptions(self):
231231 # Relay the child. It should not be accepted because it has missing inputs.
232232 self .relay_transaction (peer2 , child_low_fee ["tx" ])
233233 assert child_low_fee ["txid" ] not in node .getrawmempool ()
234+ assert tx_in_orphanage (node , child_low_fee ["tx" ])
234235
235236 # The parent should be requested because even though the txid commits to the fee, it doesn't
236237 # commit to the feerate. Delayed because it's by txid and this is not a preferred relay peer.
@@ -250,6 +251,7 @@ def test_orphan_rejected_parents_exceptions(self):
250251 # Relay the child. It should not be accepted because it has missing inputs.
251252 self .relay_transaction (peer2 , child_invalid_witness ["tx" ])
252253 assert child_invalid_witness ["txid" ] not in node .getrawmempool ()
254+ assert tx_in_orphanage (node , child_invalid_witness ["tx" ])
253255
254256 # The parent should be requested since the unstripped wtxid would differ. Delayed because
255257 # it's by txid and this is not a preferred relay peer.
@@ -298,6 +300,7 @@ def test_orphan_multiple_parents(self):
298300 self .relay_transaction (peer , orphan ["tx" ])
299301 self .nodes [0 ].bumpmocktime (NONPREF_PEER_TX_DELAY + TXID_RELAY_DELAY )
300302 peer .sync_with_ping ()
303+ assert tx_in_orphanage (node , orphan ["tx" ])
301304 assert_equal (len (peer .last_message ["getdata" ].inv ), 2 )
302305 peer .wait_for_parent_requests ([int (txid_conf_old , 16 ), int (missing_tx ["txid" ], 16 )])
303306
@@ -347,6 +350,7 @@ def test_orphans_overlapping_parents(self):
347350 # Relay orphan child_A
348351 self .relay_transaction (peer_orphans , child_A ["tx" ])
349352 self .nodes [0 ].bumpmocktime (NONPREF_PEER_TX_DELAY + TXID_RELAY_DELAY )
353+ assert tx_in_orphanage (node , child_A ["tx" ])
350354 # There are 3 missing parents. missing_parent_A and missing_parent_AB should be requested.
351355 # But inflight_parent_AB should not, because there is already an in-flight request for it.
352356 peer_orphans .wait_for_parent_requests ([int (missing_parent_A ["txid" ], 16 ), int (missing_parent_AB ["txid" ], 16 )])
@@ -355,6 +359,7 @@ def test_orphans_overlapping_parents(self):
355359 # Relay orphan child_B
356360 self .relay_transaction (peer_orphans , child_B ["tx" ])
357361 self .nodes [0 ].bumpmocktime (NONPREF_PEER_TX_DELAY + TXID_RELAY_DELAY )
362+ assert tx_in_orphanage (node , child_B ["tx" ])
358363 # Only missing_parent_B should be requested. Not inflight_parent_AB or missing_parent_AB
359364 # because they are already being requested from peer_txrequest and peer_orphans respectively.
360365 peer_orphans .wait_for_parent_requests ([int (missing_parent_B ["txid" ], 16 )])
@@ -374,12 +379,14 @@ def test_orphan_of_orphan(self):
374379 # The node should put missing_parent_orphan into the orphanage and request missing_grandparent
375380 self .relay_transaction (peer , missing_parent_orphan ["tx" ])
376381 self .nodes [0 ].bumpmocktime (NONPREF_PEER_TX_DELAY + TXID_RELAY_DELAY )
382+ assert tx_in_orphanage (node , missing_parent_orphan ["tx" ])
377383 peer .wait_for_parent_requests ([int (missing_grandparent ["txid" ], 16 )])
378384
379385 # The node should put the orphan into the orphanage and request missing_parent, skipping
380386 # missing_parent_orphan because it already has it in the orphanage.
381387 self .relay_transaction (peer , orphan ["tx" ])
382388 self .nodes [0 ].bumpmocktime (NONPREF_PEER_TX_DELAY + TXID_RELAY_DELAY )
389+ assert tx_in_orphanage (node , orphan ["tx" ])
383390 peer .wait_for_parent_requests ([int (missing_parent ["txid" ], 16 )])
384391
385392 @cleanup
@@ -399,6 +406,7 @@ def test_orphan_inherit_rejection(self):
399406
400407 # Relay the parent. It should be rejected because it pays 0 fees.
401408 self .relay_transaction (peer1 , parent_low_fee_nonsegwit ["tx" ])
409+ assert parent_low_fee_nonsegwit ["txid" ] not in node .getrawmempool ()
402410
403411 # Relay the child. It should be rejected for having missing parents, and this rejection is
404412 # cached by txid and wtxid.
@@ -438,6 +446,7 @@ def test_same_txid_orphan(self):
438446
439447 # 1. Fake orphan is received first. It is missing an input.
440448 bad_peer .send_and_ping (msg_tx (tx_orphan_bad_wit ))
449+ assert tx_in_orphanage (node , tx_orphan_bad_wit )
441450
442451 # 2. Node requests the missing parent by txid.
443452 parent_txid_int = int (tx_parent ["txid" ], 16 )
@@ -488,6 +497,7 @@ def test_same_txid_orphan_of_orphan(self):
488497
489498 # 1. Fake orphan is received first. It is missing an input.
490499 bad_peer .send_and_ping (msg_tx (tx_orphan_bad_wit ))
500+ assert tx_in_orphanage (node , tx_orphan_bad_wit )
491501
492502 # 2. Node requests missing tx_grandparent by txid.
493503 grandparent_txid_int = int (tx_grandparent ["txid" ], 16 )
@@ -519,6 +529,7 @@ def test_same_txid_orphan_of_orphan(self):
519529 assert tx_middle ["txid" ] in node_mempool
520530 assert tx_grandchild ["txid" ] in node_mempool
521531 assert_equal (node .getmempoolentry (tx_middle ["txid" ])["wtxid" ], tx_middle ["wtxid" ])
532+ assert_equal (len (node .getorphantxs ()), 0 )
522533
523534 @cleanup
524535 def test_orphan_txid_inv (self ):
@@ -537,6 +548,7 @@ def test_orphan_txid_inv(self):
537548
538549 # 1. Fake orphan is received first. It is missing an input.
539550 bad_peer .send_and_ping (msg_tx (tx_orphan_bad_wit ))
551+ assert tx_in_orphanage (node , tx_orphan_bad_wit )
540552
541553 # 2. Node requests the missing parent by txid.
542554 parent_txid_int = int (tx_parent ["txid" ], 16 )
@@ -569,6 +581,7 @@ def test_orphan_txid_inv(self):
569581 assert tx_parent ["txid" ] in node_mempool
570582 assert tx_child ["txid" ] in node_mempool
571583 assert_equal (node .getmempoolentry (tx_child ["txid" ])["wtxid" ], tx_child ["wtxid" ])
584+ assert_equal (len (node .getorphantxs ()), 0 )
572585
573586 @cleanup
574587 def test_max_orphan_amount (self ):
0 commit comments