mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
[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:
@@ -277,12 +277,9 @@ FUZZ_TARGET(txdownloadman, .init = initialize)
|
||||
// peer without tracking anything (this is only for the txdownload_impl target).
|
||||
static bool HasRelayPermissions(NodeId peer) { return peer == 0; }
|
||||
|
||||
static void CheckInvariants(const node::TxDownloadManagerImpl& txdownload_impl, size_t max_orphan_count)
|
||||
static void CheckInvariants(const node::TxDownloadManagerImpl& txdownload_impl)
|
||||
{
|
||||
// Orphanage usage should never exceed what is allowed
|
||||
Assert(txdownload_impl.m_orphanage->Size() <= max_orphan_count);
|
||||
txdownload_impl.m_orphanage->SanityCheck();
|
||||
|
||||
// We should never have more than the maximum in-flight requests out for a peer.
|
||||
for (NodeId peer = 0; peer < NUM_PEERS; ++peer) {
|
||||
if (!HasRelayPermissions(peer)) {
|
||||
@@ -301,7 +298,6 @@ FUZZ_TARGET(txdownloadman_impl, .init = initialize)
|
||||
// Initialize a TxDownloadManagerImpl
|
||||
bilingual_str error;
|
||||
CTxMemPool pool{MemPoolOptionsForTest(g_setup->m_node), error};
|
||||
const auto max_orphan_count = node::DEFAULT_MAX_ORPHAN_TRANSACTIONS;
|
||||
FastRandomContext det_rand{true};
|
||||
node::TxDownloadManagerImpl txdownload_impl{node::TxDownloadOptions{pool, det_rand, true}};
|
||||
|
||||
@@ -434,7 +430,7 @@ FUZZ_TARGET(txdownloadman_impl, .init = initialize)
|
||||
if (fuzzed_data_provider.ConsumeBool()) time_skip *= -1;
|
||||
time += time_skip;
|
||||
}
|
||||
CheckInvariants(txdownload_impl, max_orphan_count);
|
||||
CheckInvariants(txdownload_impl);
|
||||
// Disconnect everybody, check that all data structures are empty.
|
||||
for (NodeId nodeid = 0; nodeid < NUM_PEERS; ++nodeid) {
|
||||
txdownload_impl.DisconnectedPeer(nodeid);
|
||||
|
||||
@@ -52,7 +52,7 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage)
|
||||
|
||||
std::vector<CTransactionRef> tx_history;
|
||||
|
||||
LIMITED_WHILE(outpoints.size() < 200'000 && fuzzed_data_provider.ConsumeBool(), 10 * node::DEFAULT_MAX_ORPHAN_TRANSACTIONS)
|
||||
LIMITED_WHILE(outpoints.size() < 200'000 && fuzzed_data_provider.ConsumeBool(), 1000)
|
||||
{
|
||||
// construct transaction
|
||||
const CTransactionRef tx = [&] {
|
||||
@@ -100,7 +100,7 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage)
|
||||
}
|
||||
|
||||
// trigger orphanage functions
|
||||
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10 * node::DEFAULT_MAX_ORPHAN_TRANSACTIONS)
|
||||
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 1000)
|
||||
{
|
||||
NodeId peer_id = fuzzed_data_provider.ConsumeIntegral<NodeId>();
|
||||
const auto total_bytes_start{orphanage->TotalOrphanUsage()};
|
||||
@@ -220,7 +220,6 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage)
|
||||
// test mocktime and expiry
|
||||
SetMockTime(ConsumeTime(fuzzed_data_provider));
|
||||
orphanage->LimitOrphans();
|
||||
Assert(orphanage->Size() <= node::DEFAULT_MAX_ORPHAN_TRANSACTIONS);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user