@@ -231,6 +231,7 @@ def test_orphan_rejected_parents_exceptions(self):
231
231
# Relay the child. It should not be accepted because it has missing inputs.
232
232
self .relay_transaction (peer2 , child_low_fee ["tx" ])
233
233
assert child_low_fee ["txid" ] not in node .getrawmempool ()
234
+ assert tx_in_orphanage (node , child_low_fee ["tx" ])
234
235
235
236
# The parent should be requested because even though the txid commits to the fee, it doesn't
236
237
# 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):
250
251
# Relay the child. It should not be accepted because it has missing inputs.
251
252
self .relay_transaction (peer2 , child_invalid_witness ["tx" ])
252
253
assert child_invalid_witness ["txid" ] not in node .getrawmempool ()
254
+ assert tx_in_orphanage (node , child_invalid_witness ["tx" ])
253
255
254
256
# The parent should be requested since the unstripped wtxid would differ. Delayed because
255
257
# it's by txid and this is not a preferred relay peer.
@@ -298,6 +300,7 @@ def test_orphan_multiple_parents(self):
298
300
self .relay_transaction (peer , orphan ["tx" ])
299
301
self .nodes [0 ].bumpmocktime (NONPREF_PEER_TX_DELAY + TXID_RELAY_DELAY )
300
302
peer .sync_with_ping ()
303
+ assert tx_in_orphanage (node , orphan ["tx" ])
301
304
assert_equal (len (peer .last_message ["getdata" ].inv ), 2 )
302
305
peer .wait_for_parent_requests ([int (txid_conf_old , 16 ), int (missing_tx ["txid" ], 16 )])
303
306
@@ -347,6 +350,7 @@ def test_orphans_overlapping_parents(self):
347
350
# Relay orphan child_A
348
351
self .relay_transaction (peer_orphans , child_A ["tx" ])
349
352
self .nodes [0 ].bumpmocktime (NONPREF_PEER_TX_DELAY + TXID_RELAY_DELAY )
353
+ assert tx_in_orphanage (node , child_A ["tx" ])
350
354
# There are 3 missing parents. missing_parent_A and missing_parent_AB should be requested.
351
355
# But inflight_parent_AB should not, because there is already an in-flight request for it.
352
356
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):
355
359
# Relay orphan child_B
356
360
self .relay_transaction (peer_orphans , child_B ["tx" ])
357
361
self .nodes [0 ].bumpmocktime (NONPREF_PEER_TX_DELAY + TXID_RELAY_DELAY )
362
+ assert tx_in_orphanage (node , child_B ["tx" ])
358
363
# Only missing_parent_B should be requested. Not inflight_parent_AB or missing_parent_AB
359
364
# because they are already being requested from peer_txrequest and peer_orphans respectively.
360
365
peer_orphans .wait_for_parent_requests ([int (missing_parent_B ["txid" ], 16 )])
@@ -374,12 +379,14 @@ def test_orphan_of_orphan(self):
374
379
# The node should put missing_parent_orphan into the orphanage and request missing_grandparent
375
380
self .relay_transaction (peer , missing_parent_orphan ["tx" ])
376
381
self .nodes [0 ].bumpmocktime (NONPREF_PEER_TX_DELAY + TXID_RELAY_DELAY )
382
+ assert tx_in_orphanage (node , missing_parent_orphan ["tx" ])
377
383
peer .wait_for_parent_requests ([int (missing_grandparent ["txid" ], 16 )])
378
384
379
385
# The node should put the orphan into the orphanage and request missing_parent, skipping
380
386
# missing_parent_orphan because it already has it in the orphanage.
381
387
self .relay_transaction (peer , orphan ["tx" ])
382
388
self .nodes [0 ].bumpmocktime (NONPREF_PEER_TX_DELAY + TXID_RELAY_DELAY )
389
+ assert tx_in_orphanage (node , orphan ["tx" ])
383
390
peer .wait_for_parent_requests ([int (missing_parent ["txid" ], 16 )])
384
391
385
392
@cleanup
@@ -399,6 +406,7 @@ def test_orphan_inherit_rejection(self):
399
406
400
407
# Relay the parent. It should be rejected because it pays 0 fees.
401
408
self .relay_transaction (peer1 , parent_low_fee_nonsegwit ["tx" ])
409
+ assert parent_low_fee_nonsegwit ["txid" ] not in node .getrawmempool ()
402
410
403
411
# Relay the child. It should be rejected for having missing parents, and this rejection is
404
412
# cached by txid and wtxid.
@@ -438,6 +446,7 @@ def test_same_txid_orphan(self):
438
446
439
447
# 1. Fake orphan is received first. It is missing an input.
440
448
bad_peer .send_and_ping (msg_tx (tx_orphan_bad_wit ))
449
+ assert tx_in_orphanage (node , tx_orphan_bad_wit )
441
450
442
451
# 2. Node requests the missing parent by txid.
443
452
parent_txid_int = int (tx_parent ["txid" ], 16 )
@@ -488,6 +497,7 @@ def test_same_txid_orphan_of_orphan(self):
488
497
489
498
# 1. Fake orphan is received first. It is missing an input.
490
499
bad_peer .send_and_ping (msg_tx (tx_orphan_bad_wit ))
500
+ assert tx_in_orphanage (node , tx_orphan_bad_wit )
491
501
492
502
# 2. Node requests missing tx_grandparent by txid.
493
503
grandparent_txid_int = int (tx_grandparent ["txid" ], 16 )
@@ -519,6 +529,7 @@ def test_same_txid_orphan_of_orphan(self):
519
529
assert tx_middle ["txid" ] in node_mempool
520
530
assert tx_grandchild ["txid" ] in node_mempool
521
531
assert_equal (node .getmempoolentry (tx_middle ["txid" ])["wtxid" ], tx_middle ["wtxid" ])
532
+ assert_equal (len (node .getorphantxs ()), 0 )
522
533
523
534
@cleanup
524
535
def test_orphan_txid_inv (self ):
@@ -537,6 +548,7 @@ def test_orphan_txid_inv(self):
537
548
538
549
# 1. Fake orphan is received first. It is missing an input.
539
550
bad_peer .send_and_ping (msg_tx (tx_orphan_bad_wit ))
551
+ assert tx_in_orphanage (node , tx_orphan_bad_wit )
540
552
541
553
# 2. Node requests the missing parent by txid.
542
554
parent_txid_int = int (tx_parent ["txid" ], 16 )
@@ -569,6 +581,7 @@ def test_orphan_txid_inv(self):
569
581
assert tx_parent ["txid" ] in node_mempool
570
582
assert tx_child ["txid" ] in node_mempool
571
583
assert_equal (node .getmempoolentry (tx_child ["txid" ])["wtxid" ], tx_child ["wtxid" ])
584
+ assert_equal (len (node .getorphantxs ()), 0 )
572
585
573
586
@cleanup
574
587
def test_max_orphan_amount (self ):
0 commit comments