aboutsummaryrefslogtreecommitdiff
path: root/src/validation.h
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2020-06-12 14:17:44 +0000
committerpracticalswift <practicalswift@users.noreply.github.com>2021-03-11 22:34:39 +0000
commit91af6b97c9197f8ac9766a8559dd50bbc443ad38 (patch)
treef25e4032ec996d03bd1b4ac46969dccf8717b3a5 /src/validation.h
parentaf322c7494d6bc4b94890c85d16623b082c4fe24 (diff)
validation: Make DumpMempool(...) and LoadMempool(...) easier to test/fuzz/mock
Diffstat (limited to 'src/validation.h')
-rw-r--r--src/validation.h6
1 files changed, 4 insertions, 2 deletions
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<FILE*(const fs::path&, const char*)>;
+
/** 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)