mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-10 15:45:36 +01:00
test: Create test fixture for wallet
Removes all the `#ifdef ENABLE_WALLET` from `test_bitcoin` by making the wallet tests use their own fixture.
This commit is contained in:
28
src/wallet/test/wallet_test_fixture.cpp
Normal file
28
src/wallet/test/wallet_test_fixture.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "wallet/test/wallet_test_fixture.h"
|
||||
|
||||
#include "rpc/server.h"
|
||||
#include "wallet/db.h"
|
||||
#include "wallet/wallet.h"
|
||||
|
||||
WalletTestingSetup::WalletTestingSetup(const std::string& chainName):
|
||||
TestingSetup(chainName)
|
||||
{
|
||||
bitdb.MakeMock();
|
||||
|
||||
bool fFirstRun;
|
||||
pwalletMain = new CWallet("wallet.dat");
|
||||
pwalletMain->LoadWallet(fFirstRun);
|
||||
RegisterValidationInterface(pwalletMain);
|
||||
|
||||
RegisterWalletRPCCommands(tableRPC);
|
||||
}
|
||||
|
||||
WalletTestingSetup::~WalletTestingSetup()
|
||||
{
|
||||
UnregisterValidationInterface(pwalletMain);
|
||||
delete pwalletMain;
|
||||
pwalletMain = NULL;
|
||||
|
||||
bitdb.Flush(true);
|
||||
bitdb.Reset();
|
||||
}
|
||||
Reference in New Issue
Block a user