Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/wallet_test_fixture.cpp
Show All 13 Lines | |||||
WalletTestingSetup::WalletTestingSetup(const std::string &chainName) | WalletTestingSetup::WalletTestingSetup(const std::string &chainName) | ||||
: TestingSetup(chainName) { | : TestingSetup(chainName) { | ||||
bitdb.MakeMock(); | bitdb.MakeMock(); | ||||
bool fFirstRun; | bool fFirstRun; | ||||
std::unique_ptr<CWalletDBWrapper> dbw( | std::unique_ptr<CWalletDBWrapper> dbw( | ||||
new CWalletDBWrapper(&bitdb, "wallet_test.dat")); | new CWalletDBWrapper(&bitdb, "wallet_test.dat")); | ||||
pwalletMain = MakeUnique<CWallet>(Params(), std::move(dbw)); | pwalletMain = std::make_unique<CWallet>(Params(), std::move(dbw)); | ||||
pwalletMain->LoadWallet(fFirstRun); | pwalletMain->LoadWallet(fFirstRun); | ||||
RegisterValidationInterface(pwalletMain.get()); | RegisterValidationInterface(pwalletMain.get()); | ||||
RegisterWalletRPCCommands(tableRPC); | RegisterWalletRPCCommands(tableRPC); | ||||
RegisterDumpRPCCommands(tableRPC); | RegisterDumpRPCCommands(tableRPC); | ||||
} | } | ||||
WalletTestingSetup::~WalletTestingSetup() { | WalletTestingSetup::~WalletTestingSetup() { | ||||
UnregisterValidationInterface(pwalletMain.get()); | UnregisterValidationInterface(pwalletMain.get()); | ||||
pwalletMain.reset(); | pwalletMain.reset(); | ||||
bitdb.Flush(true); | bitdb.Flush(true); | ||||
bitdb.Reset(); | bitdb.Reset(); | ||||
} | } |