MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / InitWalletDirTestingSetup

Method InitWalletDirTestingSetup

src/wallet/test/init_test_fixture.cpp:17–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15
16namespace wallet {
17InitWalletDirTestingSetup::InitWalletDirTestingSetup(const ChainType chainType) : BasicTestingSetup(chainType)
18{
19 m_wallet_loader = MakeWalletLoader(*m_node.chain, m_args);
20
21 const auto sep = fs::path::preferred_separator;
22
23 m_datadir = m_args.GetDataDirNet();
24 m_cwd = fs::current_path();
25
26 m_walletdir_path_cases["default"] = m_datadir / "wallets";
27 m_walletdir_path_cases["custom"] = m_datadir / "my_wallets";
28 m_walletdir_path_cases["nonexistent"] = m_datadir / "path_does_not_exist";
29 m_walletdir_path_cases["file"] = m_datadir / "not_a_directory.dat";
30 m_walletdir_path_cases["trailing"] = (m_datadir / "wallets") + sep;
31 m_walletdir_path_cases["trailing2"] = (m_datadir / "wallets") + sep + sep;
32
33 fs::current_path(m_datadir);
34 m_walletdir_path_cases["relative"] = "wallets";
35
36 fs::create_directories(m_walletdir_path_cases["default"]);
37 fs::create_directories(m_walletdir_path_cases["custom"]);
38 fs::create_directories(m_walletdir_path_cases["relative"]);
39 std::ofstream f{m_walletdir_path_cases["file"].std_path()};
40 f.close();
41}
42
43InitWalletDirTestingSetup::~InitWalletDirTestingSetup()
44{

Callers

nothing calls this directly

Calls 3

GetDataDirNetMethod · 0.80
MakeWalletLoaderFunction · 0.50
closeMethod · 0.45

Tested by

no test coverage detected