2018-01-02 14:12:05 -03:00
|
|
|
// Copyright (c) 2016-2017 The Bitcoin Core developers
|
2016-08-22 04:24:50 -03:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2017-11-09 21:57:53 -03:00
|
|
|
#include <wallet/test/wallet_test_fixture.h>
|
2016-04-18 09:54:57 -03:00
|
|
|
|
2017-11-09 21:57:53 -03:00
|
|
|
#include <rpc/server.h>
|
|
|
|
#include <wallet/db.h>
|
2016-09-09 05:42:30 -03:00
|
|
|
|
2016-04-18 09:54:57 -03:00
|
|
|
WalletTestingSetup::WalletTestingSetup(const std::string& chainName):
|
|
|
|
TestingSetup(chainName)
|
|
|
|
{
|
|
|
|
bitdb.MakeMock();
|
|
|
|
bool fFirstRun;
|
2017-11-30 21:49:11 -03:00
|
|
|
g_address_type = OUTPUT_TYPE_DEFAULT;
|
|
|
|
g_change_type = OUTPUT_TYPE_DEFAULT;
|
2017-03-08 07:48:58 -03:00
|
|
|
std::unique_ptr<CWalletDBWrapper> dbw(new CWalletDBWrapper(&bitdb, "wallet_test.dat"));
|
2017-08-15 02:46:56 -03:00
|
|
|
pwalletMain = MakeUnique<CWallet>(std::move(dbw));
|
2016-04-18 09:54:57 -03:00
|
|
|
pwalletMain->LoadWallet(fFirstRun);
|
2017-08-09 09:01:54 -04:00
|
|
|
RegisterValidationInterface(pwalletMain.get());
|
2016-04-18 09:54:57 -03:00
|
|
|
|
|
|
|
RegisterWalletRPCCommands(tableRPC);
|
|
|
|
}
|
|
|
|
|
|
|
|
WalletTestingSetup::~WalletTestingSetup()
|
|
|
|
{
|
2017-08-09 09:01:54 -04:00
|
|
|
UnregisterValidationInterface(pwalletMain.get());
|
2016-04-18 09:54:57 -03:00
|
|
|
|
|
|
|
bitdb.Flush(true);
|
|
|
|
bitdb.Reset();
|
|
|
|
}
|