From 91af6b97c9197f8ac9766a8559dd50bbc443ad38 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Fri, 12 Jun 2020 14:17:44 +0000 Subject: validation: Make DumpMempool(...) and LoadMempool(...) easier to test/fuzz/mock --- src/validation.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/validation.h') diff --git a/src/validation.h b/src/validation.h index 512b306219..ea783ddcd1 100644 --- a/src/validation.h +++ b/src/validation.h @@ -1013,11 +1013,13 @@ int32_t ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Para /** Get block file info entry for one block file */ CBlockFileInfo* GetBlockFileInfo(size_t n); +using FopenFn = std::function; + /** Dump the mempool to disk. */ -bool DumpMempool(const CTxMemPool& pool); +bool DumpMempool(const CTxMemPool& pool, FopenFn mockable_fopen_function = fsbridge::fopen, bool skip_file_commit = false); /** Load the mempool from disk. */ -bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate); +bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate, FopenFn mockable_fopen_function = fsbridge::fopen); //! Check whether the block associated with this index entry is pruned or not. inline bool IsBlockPruned(const CBlockIndex* pblockindex) -- cgit v1.2.3