scripted-diff: Replace GetDataDir() calls with gArgs.GetDataDirNet() calls

-BEGIN VERIFY SCRIPT-
git ls-files -- 'src' ':(exclude)src/util/system.h' ':(exclude)src/util/system.cpp' | xargs sed -i 's/GetDataDir()/gArgs.GetDataDirNet()/g';
-END VERIFY SCRIPT-
This commit is contained in:
Kiminuo committed 2021-05-24 10:29:58 +02:00
1 parent 13bd8bb053
commit 4c3a5dcbfc
24 files changed
+43 -43

No files matched your search

+2 -2
View File
@@ -43,7 +43,7 @@ bool SerializeFileDB(const std::string& prefix, const fs::path& path, const Data
std::string tmpfn = strprintf("%s.%04x", prefix, randv); std::string tmpfn = strprintf("%s.%04x", prefix, randv);
// open temp output file, and associate with CAutoFile // open temp output file, and associate with CAutoFile
fs::path pathTmp = GetDataDir() / tmpfn; fs::path pathTmp = gArgs.GetDataDirNet() / tmpfn;
FILE *file = fsbridge::fopen(pathTmp, "wb"); FILE *file = fsbridge::fopen(pathTmp, "wb");
CAutoFile fileout(file, SER_DISK, CLIENT_VERSION); CAutoFile fileout(file, SER_DISK, CLIENT_VERSION);
if (fileout.IsNull()) { if (fileout.IsNull()) {
@@ -135,7 +135,7 @@ bool CBanDB::Read(banmap_t& banSet)
CAddrDB::CAddrDB() CAddrDB::CAddrDB()
{ {
pathAddr = GetDataDir() / "peers.dat"; pathAddr = gArgs.GetDataDirNet() / "peers.dat";
} }
bool CAddrDB::Write(const CAddrMan& addr) bool CAddrDB::Write(const CAddrMan& addr)
+1 -1
View File
@@ -98,7 +98,7 @@ BlockFilterIndex::BlockFilterIndex(BlockFilterType filter_type,
const std::string& filter_name = BlockFilterTypeName(filter_type); const std::string& filter_name = BlockFilterTypeName(filter_type);
if (filter_name.empty()) throw std::invalid_argument("unknown filter_type"); if (filter_name.empty()) throw std::invalid_argument("unknown filter_type");
fs::path path = GetDataDir() / "indexes" / "blockfilter" / filter_name; fs::path path = gArgs.GetDataDirNet() / "indexes" / "blockfilter" / filter_name;
fs::create_directories(path); fs::create_directories(path);
m_name = filter_name + " block filter index"; m_name = filter_name + " block filter index";
+1 -1
View File
@@ -97,7 +97,7 @@ std::unique_ptr<CoinStatsIndex> g_coin_stats_index;
CoinStatsIndex::CoinStatsIndex(size_t n_cache_size, bool f_memory, bool f_wipe) CoinStatsIndex::CoinStatsIndex(size_t n_cache_size, bool f_memory, bool f_wipe)
{ {
fs::path path{GetDataDir() / "indexes" / "coinstats"}; fs::path path{gArgs.GetDataDirNet() / "indexes" / "coinstats"};
fs::create_directories(path); fs::create_directories(path);
m_db = std::make_unique<CoinStatsIndex::DB>(path / "db", n_cache_size, f_memory, f_wipe); m_db = std::make_unique<CoinStatsIndex::DB>(path / "db", n_cache_size, f_memory, f_wipe);
+1 -1
View File
@@ -37,7 +37,7 @@ public:
}; };
TxIndex::DB::DB(size_t n_cache_size, bool f_memory, bool f_wipe) : TxIndex::DB::DB(size_t n_cache_size, bool f_memory, bool f_wipe) :
BaseIndex::DB(GetDataDir() / "indexes" / "txindex", n_cache_size, f_memory, f_wipe) BaseIndex::DB(gArgs.GetDataDirNet() / "indexes" / "txindex", n_cache_size, f_memory, f_wipe)
{} {}
bool TxIndex::DB::ReadTxPos(const uint256 &txid, CDiskTxPos& pos) const bool TxIndex::DB::ReadTxPos(const uint256 &txid, CDiskTxPos& pos) const
+5 -5
View File
@@ -1015,7 +1015,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
static bool LockDataDirectory(bool probeOnly) static bool LockDataDirectory(bool probeOnly)
{ {
// Make sure only a single Bitcoin process is using the data directory. // Make sure only a single Bitcoin process is using the data directory.
fs::path datadir = GetDataDir(); fs::path datadir = gArgs.GetDataDirNet();
if (!DirIsWritable(datadir)) { if (!DirIsWritable(datadir)) {
return InitError(strprintf(_("Cannot write to data directory '%s'; check permissions."), datadir.string())); return InitError(strprintf(_("Cannot write to data directory '%s'; check permissions."), datadir.string()));
} }
@@ -1166,7 +1166,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
assert(!node.addrman); assert(!node.addrman);
node.addrman = std::make_unique<CAddrMan>(); node.addrman = std::make_unique<CAddrMan>();
assert(!node.banman); assert(!node.banman);
node.banman = std::make_unique<BanMan>(GetDataDir() / "banlist.dat", &uiInterface, args.GetArg("-bantime", DEFAULT_MISBEHAVING_BANTIME)); node.banman = std::make_unique<BanMan>(gArgs.GetDataDirNet() / "banlist.dat", &uiInterface, args.GetArg("-bantime", DEFAULT_MISBEHAVING_BANTIME));
assert(!node.connman); assert(!node.connman);
node.connman = std::make_unique<CConnman>(GetRand(std::numeric_limits<uint64_t>::max()), GetRand(std::numeric_limits<uint64_t>::max()), *node.addrman, args.GetBoolArg("-networkactive", true)); node.connman = std::make_unique<CConnman>(GetRand(std::numeric_limits<uint64_t>::max()), GetRand(std::numeric_limits<uint64_t>::max()), *node.addrman, args.GetBoolArg("-networkactive", true));
@@ -1276,7 +1276,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
asmap_path = DEFAULT_ASMAP_FILENAME; asmap_path = DEFAULT_ASMAP_FILENAME;
} }
if (!asmap_path.is_absolute()) { if (!asmap_path.is_absolute()) {
asmap_path = GetDataDir() / asmap_path; asmap_path = gArgs.GetDataDirNet() / asmap_path;
} }
if (!fs::exists(asmap_path)) { if (!fs::exists(asmap_path)) {
InitError(strprintf(_("Could not find asmap file %s"), asmap_path)); InitError(strprintf(_("Could not find asmap file %s"), asmap_path));
@@ -1600,8 +1600,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
// ********************************************************* Step 11: import blocks // ********************************************************* Step 11: import blocks
if (!CheckDiskSpace(GetDataDir())) { if (!CheckDiskSpace(gArgs.GetDataDirNet())) {
InitError(strprintf(_("Error: Disk space is low for %s"), GetDataDir())); InitError(strprintf(_("Error: Disk space is low for %s"), gArgs.GetDataDirNet()));
return false; return false;
} }
if (!CheckDiskSpace(gArgs.GetBlocksDirPath())) { if (!CheckDiskSpace(gArgs.GetBlocksDirPath())) {
+1 -1
View File
@@ -134,7 +134,7 @@ bool StartLogging(const ArgsManager& args)
if (!LogInstance().m_log_timestamps) if (!LogInstance().m_log_timestamps)
LogPrintf("Startup time: %s\n", FormatISO8601DateTime(GetTime())); LogPrintf("Startup time: %s\n", FormatISO8601DateTime(GetTime()));
LogPrintf("Default data directory %s\n", GetDefaultDataDir().string()); LogPrintf("Default data directory %s\n", GetDefaultDataDir().string());
LogPrintf("Using data directory %s\n", GetDataDir().string()); LogPrintf("Using data directory %s\n", gArgs.GetDataDirNet().string());
// Only log conf file usage message if conf file actually exists. // Only log conf file usage message if conf file actually exists.
fs::path config_file_path = GetConfigFile(args.GetArg("-conf", BITCOIN_CONF_FILENAME)); fs::path config_file_path = GetConfigFile(args.GetArg("-conf", BITCOIN_CONF_FILENAME));
+4 -4
View File
@@ -2461,7 +2461,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
proxyType i2p_sam; proxyType i2p_sam;
if (GetProxy(NET_I2P, i2p_sam)) { if (GetProxy(NET_I2P, i2p_sam)) {
m_i2p_sam_session = std::make_unique<i2p::sam::Session>(GetDataDir() / "i2p_private_key", m_i2p_sam_session = std::make_unique<i2p::sam::Session>(gArgs.GetDataDirNet() / "i2p_private_key",
i2p_sam.proxy, &interruptNet); i2p_sam.proxy, &interruptNet);
} }
@@ -2487,7 +2487,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
if (m_use_addrman_outgoing) { if (m_use_addrman_outgoing) {
// Load addresses from anchors.dat // Load addresses from anchors.dat
m_anchors = ReadAnchors(GetDataDir() / ANCHORS_DATABASE_FILENAME); m_anchors = ReadAnchors(gArgs.GetDataDirNet() / ANCHORS_DATABASE_FILENAME);
if (m_anchors.size() > MAX_BLOCK_RELAY_ONLY_ANCHORS) { if (m_anchors.size() > MAX_BLOCK_RELAY_ONLY_ANCHORS) {
m_anchors.resize(MAX_BLOCK_RELAY_ONLY_ANCHORS); m_anchors.resize(MAX_BLOCK_RELAY_ONLY_ANCHORS);
} }
@@ -2627,7 +2627,7 @@ void CConnman::StopNodes()
if (anchors_to_dump.size() > MAX_BLOCK_RELAY_ONLY_ANCHORS) { if (anchors_to_dump.size() > MAX_BLOCK_RELAY_ONLY_ANCHORS) {
anchors_to_dump.resize(MAX_BLOCK_RELAY_ONLY_ANCHORS); anchors_to_dump.resize(MAX_BLOCK_RELAY_ONLY_ANCHORS);
} }
DumpAnchors(GetDataDir() / ANCHORS_DATABASE_FILENAME, anchors_to_dump); DumpAnchors(gArgs.GetDataDirNet() / ANCHORS_DATABASE_FILENAME, anchors_to_dump);
} }
} }
@@ -3043,7 +3043,7 @@ void CaptureMessage(const CAddress& addr, const std::string& msg_type, const Spa
std::string clean_addr = addr.ToString(); std::string clean_addr = addr.ToString();
std::replace(clean_addr.begin(), clean_addr.end(), ':', '_'); std::replace(clean_addr.begin(), clean_addr.end(), ':', '_');
fs::path base_path = GetDataDir() / "message_capture" / clean_addr; fs::path base_path = gArgs.GetDataDirNet() / "message_capture" / clean_addr;
fs::create_directories(base_path); fs::create_directories(base_path);
fs::path path = base_path / (is_incoming ? "msgs_recv.dat" : "msgs_sent.dat"); fs::path path = base_path / (is_incoming ? "msgs_recv.dat" : "msgs_sent.dat");
+2 -2
View File
@@ -504,7 +504,7 @@ CBlockPolicyEstimator::CBlockPolicyEstimator()
longStats = std::unique_ptr<TxConfirmStats>(new TxConfirmStats(buckets, bucketMap, LONG_BLOCK_PERIODS, LONG_DECAY, LONG_SCALE)); longStats = std::unique_ptr<TxConfirmStats>(new TxConfirmStats(buckets, bucketMap, LONG_BLOCK_PERIODS, LONG_DECAY, LONG_SCALE));
// If the fee estimation file is present, read recorded estimations // If the fee estimation file is present, read recorded estimations
fs::path est_filepath = GetDataDir() / FEE_ESTIMATES_FILENAME; fs::path est_filepath = gArgs.GetDataDirNet() / FEE_ESTIMATES_FILENAME;
CAutoFile est_file(fsbridge::fopen(est_filepath, "rb"), SER_DISK, CLIENT_VERSION); CAutoFile est_file(fsbridge::fopen(est_filepath, "rb"), SER_DISK, CLIENT_VERSION);
if (est_file.IsNull() || !Read(est_file)) { if (est_file.IsNull() || !Read(est_file)) {
LogPrintf("Failed to read fee estimates from %s. Continue anyway.\n", est_filepath.string()); LogPrintf("Failed to read fee estimates from %s. Continue anyway.\n", est_filepath.string());
@@ -864,7 +864,7 @@ CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, FeeCalculation
void CBlockPolicyEstimator::Flush() { void CBlockPolicyEstimator::Flush() {
FlushUnconfirmed(); FlushUnconfirmed();
fs::path est_filepath = GetDataDir() / FEE_ESTIMATES_FILENAME; fs::path est_filepath = gArgs.GetDataDirNet() / FEE_ESTIMATES_FILENAME;
CAutoFile est_file(fsbridge::fopen(est_filepath, "wb"), SER_DISK, CLIENT_VERSION); CAutoFile est_file(fsbridge::fopen(est_filepath, "wb"), SER_DISK, CLIENT_VERSION);
if (est_file.IsNull() || !Write(est_file)) { if (est_file.IsNull() || !Write(est_file)) {
LogPrintf("Failed to write fee estimates to %s. Continue anyway.\n", est_filepath.string()); LogPrintf("Failed to write fee estimates to %s. Continue anyway.\n", est_filepath.string());
+1 -1
View File
@@ -221,7 +221,7 @@ QString ClientModel::formatClientStartupTime() const
QString ClientModel::dataDir() const QString ClientModel::dataDir() const
{ {
return GUIUtil::boostPathToQString(GetDataDir()); return GUIUtil::boostPathToQString(gArgs.GetDataDirNet());
} }
QString ClientModel::blocksDir() const QString ClientModel::blocksDir() const
+1 -1
View File
@@ -405,7 +405,7 @@ void handleCloseWindowShortcut(QWidget* w)
void openDebugLogfile() void openDebugLogfile()
{ {
fs::path pathDebug = GetDataDir() / "debug.log"; fs::path pathDebug = gArgs.GetDataDirNet() / "debug.log";
/* Open debug.log with the associated application */ /* Open debug.log with the associated application */
if (fs::exists(pathDebug)) if (fs::exists(pathDebug))
+1 -1
View File
@@ -45,7 +45,7 @@ public:
* @returns true if a data directory was selected, false if the user cancelled the selection * @returns true if a data directory was selected, false if the user cancelled the selection
* dialog. * dialog.
* *
* @note do NOT call global GetDataDir() before calling this function, this * @note do NOT call global gArgs.GetDataDirNet() before calling this function, this
* will cause the wrong path to be cached. * will cause the wrong path to be cached.
*/ */
static bool showIfNeeded(bool& did_show_intro, int64_t& prune_MiB); static bool showIfNeeded(bool& did_show_intro, int64_t& prune_MiB);
+1 -1
View File
@@ -65,7 +65,7 @@ void AppTests::appTests()
fs::create_directories([] { fs::create_directories([] {
BasicTestingSetup test{CBaseChainParams::REGTEST}; // Create a temp data directory to backup the gui settings to BasicTestingSetup test{CBaseChainParams::REGTEST}; // Create a temp data directory to backup the gui settings to
return GetDataDir() / "blocks"; return gArgs.GetDataDirNet() / "blocks";
}()); }());
qRegisterMetaType<interfaces::BlockAndHeaderTipInfo>("interfaces::BlockAndHeaderTipInfo"); qRegisterMetaType<interfaces::BlockAndHeaderTipInfo>("interfaces::BlockAndHeaderTipInfo");
+2 -2
View File
@@ -2540,10 +2540,10 @@ static RPCHelpMan dumptxoutset()
}, },
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{ {
const fs::path path = fsbridge::AbsPathJoin(GetDataDir(), request.params[0].get_str()); const fs::path path = fsbridge::AbsPathJoin(gArgs.GetDataDirNet(), request.params[0].get_str());
// Write to a temporary path and then move into `path` on completion // Write to a temporary path and then move into `path` on completion
// to avoid confusion due to an interruption. // to avoid confusion due to an interruption.
const fs::path temppath = fsbridge::AbsPathJoin(GetDataDir(), request.params[0].get_str() + ".incomplete"); const fs::path temppath = fsbridge::AbsPathJoin(gArgs.GetDataDirNet(), request.params[0].get_str() + ".incomplete");
if (fs::exists(path)) { if (fs::exists(path)) {
throw JSONRPCError( throw JSONRPCError(
+1 -1
View File
@@ -34,7 +34,7 @@ FUZZ_TARGET_INIT(banman, initialize_banman)
{ {
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()}; FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
SetMockTime(ConsumeTime(fuzzed_data_provider)); SetMockTime(ConsumeTime(fuzzed_data_provider));
const fs::path banlist_file = GetDataDir() / "fuzzed_banlist.dat"; const fs::path banlist_file = gArgs.GetDataDirNet() / "fuzzed_banlist.dat";
fs::remove(banlist_file); fs::remove(banlist_file);
{ {
BanMan ban_man{banlist_file, nullptr, ConsumeBanTimeOffset(fuzzed_data_provider)}; BanMan ban_man{banlist_file, nullptr, ConsumeBanTimeOffset(fuzzed_data_provider)};
+1 -1
View File
@@ -30,7 +30,7 @@ FUZZ_TARGET_INIT(i2p, initialize_i2p)
const CService sam_proxy; const CService sam_proxy;
CThreadInterrupt interrupt; CThreadInterrupt interrupt;
i2p::sam::Session sess{GetDataDir() / "fuzzed_i2p_private_key", sam_proxy, &interrupt}; i2p::sam::Session sess{gArgs.GetDataDirNet() / "fuzzed_i2p_private_key", sam_proxy, &interrupt};
i2p::Connection conn; i2p::Connection conn;
+1 -1
View File
@@ -30,7 +30,7 @@ FUZZ_TARGET_INIT(utxo_snapshot, initialize_chain)
const auto& node = setup->m_node; const auto& node = setup->m_node;
auto& chainman{*node.chainman}; auto& chainman{*node.chainman};
const auto snapshot_path = GetDataDir() / "fuzzed_snapshot.dat"; const auto snapshot_path = gArgs.GetDataDirNet() / "fuzzed_snapshot.dat";
Assert(!chainman.SnapshotBlockhash()); Assert(!chainman.SnapshotBlockhash());
+1 -1
View File
@@ -27,7 +27,7 @@ BOOST_AUTO_TEST_CASE(unlimited_recv)
}; };
CThreadInterrupt interrupt; CThreadInterrupt interrupt;
i2p::sam::Session session(GetDataDir() / "test_i2p_private_key", CService{}, &interrupt); i2p::sam::Session session(gArgs.GetDataDirNet() / "test_i2p_private_key", CService{}, &interrupt);
{ {
ASSERT_DEBUG_LOG("Creating SAM session"); ASSERT_DEBUG_LOG("Creating SAM session");
+1 -1
View File
@@ -563,7 +563,7 @@ void TorController::Reconnect()
fs::path TorController::GetPrivateKeyFile() fs::path TorController::GetPrivateKeyFile()
{ {
return GetDataDir() / "onion_v3_private_key"; return gArgs.GetDataDirNet() / "onion_v3_private_key";
} }
void TorController::reconnect_cb(evutil_socket_t fd, short what, void *arg) void TorController::reconnect_cb(evutil_socket_t fd, short what, void *arg)
+1 -1
View File
@@ -146,7 +146,7 @@ size_t CCoinsViewDB::EstimateSize() const
return m_db->EstimateSize(DB_COIN, (char)(DB_COIN+1)); return m_db->EstimateSize(DB_COIN, (char)(DB_COIN+1));
} }
CBlockTreeDB::CBlockTreeDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(GetDataDir() / "blocks" / "index", nCacheSize, fMemory, fWipe) { CBlockTreeDB::CBlockTreeDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(gArgs.GetDataDirNet() / "blocks" / "index", nCacheSize, fMemory, fWipe) {
} }
bool CBlockTreeDB::ReadBlockFileInfo(int nFile, CBlockFileInfo &info) { bool CBlockTreeDB::ReadBlockFileInfo(int nFile, CBlockFileInfo &info) {
+5 -5
View File
@@ -1150,7 +1150,7 @@ CoinsViews::CoinsViews(
size_t cache_size_bytes, size_t cache_size_bytes,
bool in_memory, bool in_memory,
bool should_wipe) : m_dbview( bool should_wipe) : m_dbview(
GetDataDir() / ldb_name, cache_size_bytes, in_memory, should_wipe), gArgs.GetDataDirNet() / ldb_name, cache_size_bytes, in_memory, should_wipe),
m_catcherview(&m_dbview) {} m_catcherview(&m_dbview) {}
void CoinsViews::InitCache() void CoinsViews::InitCache()
@@ -2128,7 +2128,7 @@ bool CChainState::FlushStateToDisk(
// twice (once in the log, and once in the tables). This is already // twice (once in the log, and once in the tables). This is already
// an overestimation, as most will delete an existing entry or // an overestimation, as most will delete an existing entry or
// overwrite one. Still, use a conservative safety factor of 2. // overwrite one. Still, use a conservative safety factor of 2.
if (!CheckDiskSpace(GetDataDir(), 48 * 2 * 2 * CoinsTip().GetCacheSize())) { if (!CheckDiskSpace(gArgs.GetDataDirNet(), 48 * 2 * 2 * CoinsTip().GetCacheSize())) {
return AbortNode(state, "Disk space is too low!", _("Disk space is too low!")); return AbortNode(state, "Disk space is too low!", _("Disk space is too low!"));
} }
// Flush the chainstate (which may refer to block index entries). // Flush the chainstate (which may refer to block index entries).
@@ -4501,7 +4501,7 @@ bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate, FopenFn mocka
{ {
const CChainParams& chainparams = Params(); const CChainParams& chainparams = Params();
int64_t nExpiryTimeout = gArgs.GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60; int64_t nExpiryTimeout = gArgs.GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60;
FILE* filestr{mockable_fopen_function(GetDataDir() / "mempool.dat", "rb")}; FILE* filestr{mockable_fopen_function(gArgs.GetDataDirNet() / "mempool.dat", "rb")};
CAutoFile file(filestr, SER_DISK, CLIENT_VERSION); CAutoFile file(filestr, SER_DISK, CLIENT_VERSION);
if (file.IsNull()) { if (file.IsNull()) {
LogPrintf("Failed to open mempool file from disk. Continuing anyway.\n"); LogPrintf("Failed to open mempool file from disk. Continuing anyway.\n");
@@ -4605,7 +4605,7 @@ bool DumpMempool(const CTxMemPool& pool, FopenFn mockable_fopen_function, bool s
int64_t mid = GetTimeMicros(); int64_t mid = GetTimeMicros();
try { try {
FILE* filestr{mockable_fopen_function(GetDataDir() / "mempool.dat.new", "wb")}; FILE* filestr{mockable_fopen_function(gArgs.GetDataDirNet() / "mempool.dat.new", "wb")};
if (!filestr) { if (!filestr) {
return false; return false;
} }
@@ -4631,7 +4631,7 @@ bool DumpMempool(const CTxMemPool& pool, FopenFn mockable_fopen_function, bool s
if (!skip_file_commit && !FileCommit(file.Get())) if (!skip_file_commit && !FileCommit(file.Get()))
throw std::runtime_error("FileCommit failed"); throw std::runtime_error("FileCommit failed");
file.fclose(); file.fclose();
if (!RenameOver(GetDataDir() / "mempool.dat.new", GetDataDir() / "mempool.dat")) { if (!RenameOver(gArgs.GetDataDirNet() / "mempool.dat.new", gArgs.GetDataDirNet() / "mempool.dat")) {
throw std::runtime_error("Rename failed"); throw std::runtime_error("Rename failed");
} }
int64_t last = GetTimeMicros(); int64_t last = GetTimeMicros();
+6 -6
View File
@@ -23,7 +23,7 @@ static std::shared_ptr<BerkeleyEnvironment> GetWalletEnv(const fs::path& path, s
BOOST_AUTO_TEST_CASE(getwalletenv_file) BOOST_AUTO_TEST_CASE(getwalletenv_file)
{ {
std::string test_name = "test_name.dat"; std::string test_name = "test_name.dat";
const fs::path datadir = GetDataDir(); const fs::path datadir = gArgs.GetDataDirNet();
fs::path file_path = datadir / test_name; fs::path file_path = datadir / test_name;
std::ofstream f(file_path.BOOST_FILESYSTEM_C_STR); std::ofstream f(file_path.BOOST_FILESYSTEM_C_STR);
f.close(); f.close();
@@ -37,7 +37,7 @@ BOOST_AUTO_TEST_CASE(getwalletenv_file)
BOOST_AUTO_TEST_CASE(getwalletenv_directory) BOOST_AUTO_TEST_CASE(getwalletenv_directory)
{ {
std::string expected_name = "wallet.dat"; std::string expected_name = "wallet.dat";
const fs::path datadir = GetDataDir(); const fs::path datadir = gArgs.GetDataDirNet();
std::string filename; std::string filename;
std::shared_ptr<BerkeleyEnvironment> env = GetWalletEnv(datadir, filename); std::shared_ptr<BerkeleyEnvironment> env = GetWalletEnv(datadir, filename);
@@ -47,8 +47,8 @@ BOOST_AUTO_TEST_CASE(getwalletenv_directory)
BOOST_AUTO_TEST_CASE(getwalletenv_g_dbenvs_multiple) BOOST_AUTO_TEST_CASE(getwalletenv_g_dbenvs_multiple)
{ {
fs::path datadir = GetDataDir() / "1"; fs::path datadir = gArgs.GetDataDirNet() / "1";
fs::path datadir_2 = GetDataDir() / "2"; fs::path datadir_2 = gArgs.GetDataDirNet() / "2";
std::string filename; std::string filename;
std::shared_ptr<BerkeleyEnvironment> env_1 = GetWalletEnv(datadir, filename); std::shared_ptr<BerkeleyEnvironment> env_1 = GetWalletEnv(datadir, filename);
@@ -61,8 +61,8 @@ BOOST_AUTO_TEST_CASE(getwalletenv_g_dbenvs_multiple)
BOOST_AUTO_TEST_CASE(getwalletenv_g_dbenvs_free_instance) BOOST_AUTO_TEST_CASE(getwalletenv_g_dbenvs_free_instance)
{ {
fs::path datadir = GetDataDir() / "1"; fs::path datadir = gArgs.GetDataDirNet() / "1";
fs::path datadir_2 = GetDataDir() / "2"; fs::path datadir_2 = gArgs.GetDataDirNet() / "2";
std::string filename; std::string filename;
std::shared_ptr <BerkeleyEnvironment> env_1_a = GetWalletEnv(datadir, filename); std::shared_ptr <BerkeleyEnvironment> env_1_a = GetWalletEnv(datadir, filename);
+1 -1
View File
@@ -16,7 +16,7 @@ InitWalletDirTestingSetup::InitWalletDirTestingSetup(const std::string& chainNam
std::string sep; std::string sep;
sep += fs::path::preferred_separator; sep += fs::path::preferred_separator;
m_datadir = GetDataDir(); m_datadir = gArgs.GetDataDirNet();
m_cwd = fs::current_path(); m_cwd = fs::current_path();
m_walletdir_path_cases["default"] = m_datadir / "wallets"; m_walletdir_path_cases["default"] = m_datadir / "wallets";
+1 -1
View File
@@ -253,7 +253,7 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
SetMockTime(KEY_TIME); SetMockTime(KEY_TIME);
m_coinbase_txns.emplace_back(CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]); m_coinbase_txns.emplace_back(CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
std::string backup_file = (GetDataDir() / "wallet.backup").string(); std::string backup_file = (gArgs.GetDataDirNet() / "wallet.backup").string();
// Import key into wallet and call dumpwallet to create backup file. // Import key into wallet and call dumpwallet to create backup file.
{ {
+1 -1
View File
@@ -19,7 +19,7 @@ fs::path GetWalletDir()
path = ""; path = "";
} }
} else { } else {
path = GetDataDir(); path = gArgs.GetDataDirNet();
// If a wallets directory exists, use that, otherwise default to GetDataDir // If a wallets directory exists, use that, otherwise default to GetDataDir
if (fs::is_directory(path / "wallets")) { if (fs::is_directory(path / "wallets")) {
path /= "wallets"; path /= "wallets";