Bitcoin ABC  0.26.3
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 <scheduler.h>
9 #include <validationinterface.h>
10 #include <wallet/rpc/backup.h>
11 
12 WalletTestingSetup::WalletTestingSetup(const std::string &chainName)
13  : TestingSetup(chainName),
14  m_wallet(m_node.chain.get(), "", CreateMockWalletDatabase()) {
15  bool fFirstRun;
16  m_wallet.LoadWallet(fFirstRun);
18  m_node.chain->handleNotifications({&m_wallet, [](CWallet *) {}});
19  m_wallet_client->registerRpcs();
20 }
21 
23  if (m_node.scheduler) {
24  m_node.scheduler->stop();
25  }
26 }
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:253
DBErrors LoadWallet(bool &fFirstRunRet)
Definition: wallet.cpp:2167
NodeContext & m_node
Definition: interfaces.cpp:766
WalletTestingSetup(const std::string &chainName=CBaseChainParams::MAIN)
std::unique_ptr< interfaces::Handler > m_chain_notifications_handler
std::unique_ptr< interfaces::WalletClient > m_wallet_client
std::shared_ptr< CWallet > m_wallet
Definition: interfaces.cpp:479
std::unique_ptr< WalletDatabase > CreateMockWalletDatabase()
Return object for accessing temporary in-memory database.
Definition: walletdb.cpp:1169