Bitcoin ABC  0.24.7
P2P Digital Currency
wallet_test_fixture.cpp
Go to the documentation of this file.
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.
4 
6 
7 #include <chainparams.h>
8 #include <validationinterface.h>
9 #include <wallet/rpcdump.h>
10 
11 WalletTestingSetup::WalletTestingSetup(const std::string &chainName)
12  : TestingSetup(chainName), m_chain(interfaces::MakeChain(m_node, Params())),
13  m_wallet(m_chain.get(), "", CreateMockWalletDatabase()) {
14  bool fFirstRun;
15  m_wallet.LoadWallet(fFirstRun);
17  m_chain->handleNotifications({&m_wallet, [](CWallet *) {}});
18  m_wallet_client->registerRpcs();
19 }
interfaces
Definition: dummywallet.cpp:12
m_wallet
std::shared_ptr< CWallet > m_wallet
Definition: wallet.cpp:462
WalletTestingSetup::m_wallet
CWallet m_wallet
Definition: wallet_test_fixture.h:28
validationinterface.h
WalletTestingSetup::m_chain_notifications_handler
std::unique_ptr< interfaces::Handler > m_chain_notifications_handler
Definition: wallet_test_fixture.h:29
chainparams.h
WalletTestingSetup::WalletTestingSetup
WalletTestingSetup(const std::string &chainName=CBaseChainParams::MAIN)
Definition: wallet_test_fixture.cpp:11
WalletTestingSetup::m_wallet_client
std::unique_ptr< interfaces::WalletClient > m_wallet_client
Definition: wallet_test_fixture.h:26
CWallet::LoadWallet
DBErrors LoadWallet(bool &fFirstRunRet)
Definition: wallet.cpp:3576
wallet_test_fixture.h
m_node
NodeContext & m_node
Definition: chain.cpp:485
WalletTestingSetup::m_chain
std::unique_ptr< interfaces::Chain > m_chain
Definition: wallet_test_fixture.h:25
CreateMockWalletDatabase
std::unique_ptr< WalletDatabase > CreateMockWalletDatabase()
Return object for accessing temporary in-memory database.
Definition: walletdb.cpp:1169
CWallet
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:678
Params
const CChainParams & Params()
Return the currently selected parameters.
Definition: chainparams.cpp:508
rpcdump.h
interfaces::MakeChain
std::unique_ptr< Chain > MakeChain(NodeContext &node, const CChainParams &params)
Return implementation of Chain interface.
Definition: chain.cpp:491