mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-25 23:16:16 +01:00
test/fuzz: Invoke LoadMempool via CChainState
Not only does this increase coverage, it is also more correct in that when ::LoadMempool is called with a mempool and chainstate, it calls AcceptToMemoryPool with just the chainstate. AcceptToMemoryPool will then act on the chainstate's mempool via CChainState::GetMempool, which may be different from the mempool originally passed to ::LoadMempool. (In this fuzz test's case, it definitely is different) Also, move DummyChainstate to its own file since it's now used by the validation_load_mempool fuzz test to replace CChainState's m_mempool.
This commit is contained in:
@@ -3865,11 +3865,11 @@ void PruneBlockFilesManual(CChainState& active_chainstate, int nManualPruneHeigh
|
||||
}
|
||||
}
|
||||
|
||||
void CChainState::LoadMempool(const ArgsManager& args)
|
||||
void CChainState::LoadMempool(const ArgsManager& args, FopenFn mockable_fopen_function)
|
||||
{
|
||||
if (!m_mempool) return;
|
||||
if (args.GetBoolArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
|
||||
::LoadMempool(*m_mempool, *this);
|
||||
::LoadMempool(*m_mempool, *this, mockable_fopen_function);
|
||||
}
|
||||
m_mempool->SetLoadTried(!ShutdownRequested());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user