mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-28 14:02:53 +02:00
Merge bitcoin/bitcoin#29031: fuzz: Improve fuzzing stability for txorphan harness
15f5a0d0c8
fuzz: Improve fuzzing stability for txorphan harness (dergoegge) Pull request description: The `txorphan` harness has low stability as eviction of orphan txs is entirely random at the moment. Fix this by passing the rng to `LimitOrphans`, which can be deterministic in tests. Also see #29018. ACKs for top commit: maflcko: lgtm ACK15f5a0d0c8
brunoerg: utACK15f5a0d0c8
Tree-SHA512: 854ec34b3a0f16f26db6dc419096c6e7a380e8400119534aa278d6b1d54c253b572aa2fad13c383c796c431d8ff4263956e6f60326e99f8bf6abd16d9a280e97
This commit is contained in:
@@ -33,6 +33,7 @@ void initialize_orphanage()
|
||||
FUZZ_TARGET(txorphan, .init = initialize_orphanage)
|
||||
{
|
||||
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
|
||||
FastRandomContext limit_orphans_rng{/*fDeterministic=*/true};
|
||||
SetMockTime(ConsumeTime(fuzzed_data_provider));
|
||||
|
||||
TxOrphanage orphanage;
|
||||
@@ -132,7 +133,7 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage)
|
||||
// test mocktime and expiry
|
||||
SetMockTime(ConsumeTime(fuzzed_data_provider));
|
||||
auto limit = fuzzed_data_provider.ConsumeIntegral<unsigned int>();
|
||||
orphanage.LimitOrphans(limit);
|
||||
orphanage.LimitOrphans(limit, limit_orphans_rng);
|
||||
Assert(orphanage.Size() <= limit);
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user