DumpMempool: Pass in dump_path, stop using gArgs

Also introduce node::{ShouldPersistMempool,MempoolPath} helper functions
in node/mempool_persist_args.{h,cpp} which are used by non-kernel
DumpMempool callers to determine whether or not to automatically dump
the mempool and where to dump it to.
This commit is contained in:
Carl Dong
2022-07-12 15:54:11 -04:00
parent bd4407817e
commit 413f4bb52b
8 changed files with 64 additions and 9 deletions

View File

@@ -4,6 +4,7 @@
#include <chainparamsbase.h>
#include <mempool_args.h>
#include <node/mempool_persist_args.h>
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
@@ -15,6 +16,8 @@
#include <cstdint>
#include <vector>
using node::MempoolPath;
namespace {
const TestingSetup* g_setup;
} // namespace
@@ -37,5 +40,5 @@ FUZZ_TARGET_INIT(validation_load_mempool, initialize_validation_load_mempool)
return fuzzed_file_provider.open();
};
(void)LoadMempool(pool, g_setup->m_node.chainman->ActiveChainstate(), fuzzed_fopen);
(void)DumpMempool(pool, fuzzed_fopen, true);
(void)DumpMempool(pool, MempoolPath(g_setup->m_args), fuzzed_fopen, true);
}