mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
refactor: Add path argument to FindSnapshotChainstateDir
Remove access to the global gArgs for getting the directory in utxo_snapshot. This is done in the context of the libbitcoinkernel project, wherein reliance of libbitcoinkernel code on the global gArgs is incrementally removed.
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <node/utxo_snapshot.h>
|
||||
|
||||
#include <common/args.h>
|
||||
#include <logging.h>
|
||||
#include <streams.h>
|
||||
#include <sync.h>
|
||||
@@ -82,10 +81,10 @@ std::optional<uint256> ReadSnapshotBaseBlockhash(fs::path chaindir)
|
||||
return base_blockhash;
|
||||
}
|
||||
|
||||
std::optional<fs::path> FindSnapshotChainstateDir()
|
||||
std::optional<fs::path> FindSnapshotChainstateDir(const fs::path& data_dir)
|
||||
{
|
||||
fs::path possible_dir =
|
||||
gArgs.GetDataDirNet() / fs::u8path(strprintf("chainstate%s", SNAPSHOT_CHAINSTATE_SUFFIX));
|
||||
data_dir / fs::u8path(strprintf("chainstate%s", SNAPSHOT_CHAINSTATE_SUFFIX));
|
||||
|
||||
if (fs::exists(possible_dir)) {
|
||||
return possible_dir;
|
||||
|
||||
@@ -67,7 +67,7 @@ constexpr std::string_view SNAPSHOT_CHAINSTATE_SUFFIX = "_snapshot";
|
||||
|
||||
|
||||
//! Return a path to the snapshot-based chainstate dir, if one exists.
|
||||
std::optional<fs::path> FindSnapshotChainstateDir();
|
||||
std::optional<fs::path> FindSnapshotChainstateDir(const fs::path& data_dir);
|
||||
|
||||
} // namespace node
|
||||
|
||||
|
||||
Reference in New Issue
Block a user