Merge #11722: Switched sync.{cpp,h} to std threading primitives.
[bitcoinplatinum.git] / src / wallet / test / wallet_test_fixture.cpp
blob3ee83d2d7c28dc8976bfdd1958ef99db64a1f4d8
1 // Copyright (c) 2016 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #include <wallet/test/wallet_test_fixture.h>
7 #include <rpc/server.h>
8 #include <wallet/db.h>
10 WalletTestingSetup::WalletTestingSetup(const std::string& chainName):
11 TestingSetup(chainName)
13 bitdb.MakeMock();
15 bool fFirstRun;
16 std::unique_ptr<CWalletDBWrapper> dbw(new CWalletDBWrapper(&bitdb, "wallet_test.dat"));
17 pwalletMain = MakeUnique<CWallet>(std::move(dbw));
18 pwalletMain->LoadWallet(fFirstRun);
19 RegisterValidationInterface(pwalletMain.get());
21 RegisterWalletRPCCommands(tableRPC);
24 WalletTestingSetup::~WalletTestingSetup()
26 UnregisterValidationInterface(pwalletMain.get());
28 bitdb.Flush(true);
29 bitdb.Reset();