MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / GetWalletEnv

Function GetWalletEnv

src/wallet/db.cpp:59–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57} // namespace
58
59BerkeleyEnvironment* GetWalletEnv(const fs::path& wallet_path, std::string& database_filename)
60{
61 fs::path env_directory;
62 if (fs::is_regular_file(wallet_path)) {
63 // Special case for backwards compatibility: if wallet path points to an
64 // existing file, treat it as the path to a BDB data file in a parent
65 // directory that also contains BDB log files.
66 env_directory = wallet_path.parent_path();
67 database_filename = wallet_path.filename().string();
68 } else {
69 // Normal case: Interpret wallet path as a directory path containing
70 // data and log files.
71 env_directory = wallet_path;
72 database_filename = "wallet.dat";
73 }
74 LOCK(cs_db);
75 // Note: An ununsed temporary BerkeleyEnvironment object may be created inside the
76 // emplace function if the key already exists. This is a little inefficient,
77 // but not a big concern since the map will be changed in the future to hold
78 // pointers instead of objects, anyway.
79 return &g_dbenvs.emplace(std::piecewise_construct, std::forward_as_tuple(env_directory.string()), std::forward_as_tuple(env_directory)).first->second;
80}
81
82//
83// BerkeleyBatch

Callers 4

RecoverMethod · 0.85
VerifyEnvironmentMethod · 0.85
VerifyDatabaseFileMethod · 0.85
BerkeleyDatabaseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected