refactor: log nEvicted message in LimitOrphans then return void

`LimitOrphans()` can log expired tx and it should log evicted tx as well
instead of returning the number for caller to print the message.
Since `LimitOrphans()` now return void, the redundant assertion check in
fuzz test is also removed.
This commit is contained in:
chinggg
2022-07-23 20:51:07 +08:00
parent 194f6dc43c
commit b4b657ba57
4 changed files with 5 additions and 10 deletions

View File

@@ -138,10 +138,8 @@ FUZZ_TARGET_INIT(txorphan, initialize_orphanage)
[&] {
// test mocktime and expiry
SetMockTime(ConsumeTime(fuzzed_data_provider));
auto size_before = orphanage.Size();
auto limit = fuzzed_data_provider.ConsumeIntegral<unsigned int>();
auto n_evicted = WITH_LOCK(g_cs_orphans, return orphanage.LimitOrphans(limit));
Assert(size_before - n_evicted <= limit);
WITH_LOCK(g_cs_orphans, orphanage.LimitOrphans(limit));
Assert(orphanage.Size() <= limit);
});
}