refactor: Add and use kernel::ImportMempoolOptions

This allows optional named arguments with default values.
This commit is contained in:
MarcoFalke
2023-04-13 10:52:40 +02:00
parent fa8866990d
commit fa20d734a2
4 changed files with 11 additions and 5 deletions

View File

@@ -36,11 +36,11 @@ namespace kernel {
static const uint64_t MEMPOOL_DUMP_VERSION = 1;
bool LoadMempool(CTxMemPool& pool, const fs::path& load_path, Chainstate& active_chainstate, FopenFn mockable_fopen_function)
bool LoadMempool(CTxMemPool& pool, const fs::path& load_path, Chainstate& active_chainstate, ImportMempoolOptions&& opts)
{
if (load_path.empty()) return false;
FILE* filestr{mockable_fopen_function(load_path, "rb")};
FILE* filestr{opts.mockable_fopen_function(load_path, "rb")};
CAutoFile file(filestr, SER_DISK, CLIENT_VERSION);
if (file.IsNull()) {
LogPrintf("Failed to open mempool file from disk. Continuing anyway.\n");