diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h --- a/src/test/util/setup_common.h +++ b/src/test/util/setup_common.h @@ -109,6 +109,7 @@ ~BasicTestingSetup(); const fs::path m_path_root; + ArgsManager m_args; }; /** diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -90,7 +90,8 @@ BasicTestingSetup::BasicTestingSetup( const std::string &chainName, const std::vector &extra_args) : m_path_root{fs::temp_directory_path() / "test_common_" PACKAGE_NAME / - g_insecure_rand_ctx_temp_path.rand256().ToString()} { + g_insecure_rand_ctx_temp_path.rand256().ToString()}, + m_args{} { // clang-format off std::vector arguments = Cat( { @@ -107,6 +108,7 @@ auto &config = const_cast(GetConfig()); SetMockTime(0); fs::create_directories(m_path_root); + m_args.ForceSetArg("-datadir", m_path_root.string()); gArgs.ForceSetArg("-datadir", m_path_root.string()); ClearDatadirCache(); { @@ -203,9 +205,9 @@ threadGroup.create_thread([i]() { return ThreadScriptCheck(i); }); } - m_node.banman = - std::make_unique(GetDataDir() / "banlist.dat", chainparams, - nullptr, DEFAULT_MISBEHAVING_BANTIME); + m_node.banman = std::make_unique( + m_args.GetDataDirPath() / "banlist.dat", chainparams, nullptr, + DEFAULT_MISBEHAVING_BANTIME); // Deterministic randomness for tests. m_node.connman = std::make_unique(config, 0x1337, 0x1337); m_node.peerman = std::make_unique(