[p2p] bump DEFAULT_MAX_ORPHANAGE_LATENCY_SCORE to 3,000

For the default number of peers (125), allows each to relay a default
descendant package (up to 25-1=24 can be missing inputs) of small (9
inputs or fewer) transactions out of order.

This limit also gives acceptable bounds for worst case LimitOrphans iterations.

Functional tests aren't changed to check for larger cap because it would
make the runtime too long.

Also deletes the now-unused DEFAULT_MAX_ORPHAN_TRANSACTIONS.
This commit is contained in:
glozow
2025-05-16 11:16:04 -04:00
parent 24afee8d8f
commit ea29c4371e
5 changed files with 10 additions and 60 deletions

View File

@@ -143,14 +143,14 @@ class InvalidTxRequestTest(BitcoinTestFramework):
self.wait_until(lambda: 1 == len(node.getpeerinfo()), timeout=12) # p2ps[1] is no longer connected
assert_equal(expected_mempool, set(node.getrawmempool()))
self.log.info('Test orphan pool overflow')
self.log.info('Test orphanage can store more than 100 transactions')
orphan_tx_pool = [CTransaction() for _ in range(101)]
for i in range(len(orphan_tx_pool)):
orphan_tx_pool[i].vin.append(CTxIn(outpoint=COutPoint(i, 333)))
orphan_tx_pool[i].vout.append(CTxOut(nValue=11 * COIN, scriptPubKey=SCRIPT_PUB_KEY_OP_TRUE))
with node.assert_debug_log(['orphanage overflow, removed 1 tx']):
node.p2ps[0].send_txs_and_test(orphan_tx_pool, node, success=False)
node.p2ps[0].send_txs_and_test(orphan_tx_pool, node, success=False)
self.wait_until(lambda: len(node.getorphantxs()) >= 101)
self.log.info('Test orphan with rejected parents')
rejected_parent = CTransaction()
@@ -160,8 +160,8 @@ class InvalidTxRequestTest(BitcoinTestFramework):
node.p2ps[0].send_txs_and_test([rejected_parent], node, success=False)
self.log.info('Test that a peer disconnection causes erase its transactions from the orphan pool')
with node.assert_debug_log(['Erased 100 orphan transaction(s) from peer=26']):
self.reconnect_p2p(num_connections=1)
self.reconnect_p2p(num_connections=1)
self.wait_until(lambda: len(node.getorphantxs()) == 0)
self.log.info('Test that a transaction in the orphan pool is included in a new tip block causes erase this transaction from the orphan pool')
tx_withhold_until_block_A = CTransaction()