@@ -407,9 +407,10 @@ def test_orphanage_dos_large(self):
407
407
408
408
peer_normal = node .add_p2p_connection (P2PInterface ())
409
409
peer_doser = node .add_p2p_connection (P2PInterface ())
410
+ num_individual_dosers = 10
410
411
411
412
self .log .info ("Create very large orphans to be sent by DoSy peers (may take a while)" )
412
- large_orphans = [create_large_orphan () for _ in range (100 )]
413
+ large_orphans = [create_large_orphan () for _ in range (50 )]
413
414
# Check to make sure these are orphans, within max standard size (to be accepted into the orphanage)
414
415
for large_orphan in large_orphans :
415
416
assert_greater_than_or_equal (100000 , large_orphan .get_vsize ())
@@ -419,11 +420,10 @@ def test_orphanage_dos_large(self):
419
420
assert not testres [0 ]["allowed" ]
420
421
assert_equal (testres [0 ]["reject-reason" ], "missing-inputs" )
421
422
422
- num_individual_dosers = 30
423
423
self .log .info (f"Connect { num_individual_dosers } peers and send a very large orphan from each one" )
424
424
# This test assumes that unrequested transactions are processed (skipping inv and
425
425
# getdata steps because they require going through request delays)
426
- # Connect 20 peers and have each of them send a large orphan.
426
+ # Connect 10 peers and have each of them send a large orphan.
427
427
for large_orphan in large_orphans [:num_individual_dosers ]:
428
428
peer_doser_individual = node .add_p2p_connection (P2PInterface ())
429
429
peer_doser_individual .send_and_ping (msg_tx (large_orphan ))
@@ -459,7 +459,7 @@ def test_orphanage_dos_large(self):
459
459
peer_normal .wait_for_getdata ([parent_txid_int ])
460
460
461
461
self .log .info ("Send another round of very large orphans from a DoSy peer" )
462
- for large_orphan in large_orphans [30 :]:
462
+ for large_orphan in large_orphans [num_individual_dosers :]:
463
463
peer_doser .send_and_ping (msg_tx (large_orphan ))
464
464
465
465
# Something was evicted; the orphanage does not contain all large orphans + the 1p1c child
@@ -477,12 +477,12 @@ def test_orphanage_dos_many(self):
477
477
478
478
peer_normal = node .add_p2p_connection (P2PInterface ())
479
479
480
- # 2 sets of peers: the first set all send the same batch_size orphans. The second set each
481
- # sends batch_size distinct orphans.
480
+ # The first set of peers all send the same batch_size orphans. Then a single peer sends
481
+ # batch_single_doser distinct orphans.
482
482
batch_size = 51
483
483
num_peers_shared = 60
484
- num_peers_unique = 40
485
-
484
+ batch_single_doser = 100
485
+ assert_greater_than ( num_peers_shared * batch_size + batch_single_doser , 3000 )
486
486
# 60 peers * 51 orphans = 3060 announcements
487
487
shared_orphans = [self .create_small_orphan () for _ in range (batch_size )]
488
488
self .log .info (f"Send the same { batch_size } orphans from { num_peers_shared } DoSy peers (may take a while)" )
@@ -522,22 +522,15 @@ def test_orphanage_dos_many(self):
522
522
node .bumpmocktime (NONPREF_PEER_TX_DELAY + TXID_RELAY_DELAY )
523
523
peer_normal .wait_for_getdata ([parent_txid_int ])
524
524
525
- # Each of the num_peers_unique peers creates a distinct set of orphans
526
- many_orphans = [self .create_small_orphan () for _ in range (batch_size * num_peers_unique )]
527
-
528
- self .log .info (f"Send sets of { batch_size } orphans from { num_peers_unique } DoSy peers (may take a while)" )
529
- for peernum in range (num_peers_unique ):
530
- peer_doser_batch = node .add_p2p_connection (P2PInterface ())
531
- this_batch_orphans = many_orphans [batch_size * peernum : batch_size * (peernum + 1 )]
532
- for tx in this_batch_orphans :
533
- # Don't wait for responses, because it dramatically increases the runtime of this test.
534
- peer_doser_batch .send_without_ping (msg_tx (tx ))
535
-
536
- # Ensure at least one of the peer's orphans shows up in getorphantxs. Since each peer is
537
- # reserved a portion of orphanage space, this must happen as long as the orphans are not
538
- # rejected for some other reason.
539
- peer_doser_batch .sync_with_ping ()
540
- self .wait_until (lambda : any ([tx .txid_hex in node .getorphantxs () for tx in this_batch_orphans ]))
525
+ self .log .info (f"Send { batch_single_doser } new orphans from one DoSy peer" )
526
+ peer_doser_batch = node .add_p2p_connection (P2PInterface ())
527
+ this_batch_orphans = [self .create_small_orphan () for _ in range (batch_single_doser )]
528
+ for tx in this_batch_orphans :
529
+ # Don't wait for responses, because it dramatically increases the runtime of this test.
530
+ peer_doser_batch .send_without_ping (msg_tx (tx ))
531
+
532
+ peer_doser_batch .sync_with_ping ()
533
+ self .wait_until (lambda : any ([tx .txid_hex in node .getorphantxs () for tx in this_batch_orphans ]))
541
534
542
535
self .log .info ("Check that orphan from normal peer still exists in orphanage" )
543
536
assert high_fee_child ["txid" ] in node .getorphantxs ()
0 commit comments