Bitcoin Core  22.99.0
P2P Digital Currency
wallet_test_fixture.cpp
Go to the documentation of this file.
1 // Copyright (c) 2016-2021 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 <scheduler.h>
8 
9 namespace wallet {
10 WalletTestingSetup::WalletTestingSetup(const std::string& chainName)
11  : TestingSetup(chainName),
12  m_wallet(m_node.chain.get(), "", m_args, CreateMockWalletDatabase())
13 {
15  m_chain_notifications_handler = m_node.chain->handleNotifications({ &m_wallet, [](CWallet*) {} });
16  m_wallet_loader->registerRpcs();
17 }
18 
20 {
21  if (m_node.scheduler) m_node.scheduler->stop();
22 }
23 } // namespace wallet
BasicTestingSetup::m_node
node::NodeContext m_node
Definition: setup_common.h:85
m_node
node::NodeContext m_node
Definition: bitcoin-gui.cpp:36
wallet
Definition: node.h:38
wallet::WalletTestingSetup::~WalletTestingSetup
~WalletTestingSetup()
Definition: wallet_test_fixture.cpp:19
scheduler.h
node::NodeContext::scheduler
std::unique_ptr< CScheduler > scheduler
Definition: context.h:57
wallet::CWallet
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:232
wallet::WalletTestingSetup::m_wallet
CWallet m_wallet
Definition: wallet_test_fixture.h:26
wallet::CreateMockWalletDatabase
std::unique_ptr< WalletDatabase > CreateMockWalletDatabase()
Return object for accessing temporary in-memory database.
Definition: walletdb.cpp:1190
wallet_test_fixture.h
wallet::CWallet::LoadWallet
DBErrors LoadWallet()
Definition: wallet.cpp:2116
wallet::WalletTestingSetup::m_chain_notifications_handler
std::unique_ptr< interfaces::Handler > m_chain_notifications_handler
Definition: wallet_test_fixture.h:27
wallet::WalletTestingSetup::WalletTestingSetup
WalletTestingSetup(const std::string &chainName=CBaseChainParams::MAIN)
Definition: wallet_test_fixture.cpp:10
m_wallet
std::shared_ptr< CWallet > m_wallet
Definition: interfaces.cpp:509
TestingSetup
Testing setup that configures a complete environment.
Definition: setup_common.h:107
wallet::WalletTestingSetup::m_wallet_loader
std::unique_ptr< interfaces::WalletLoader > m_wallet_loader
Definition: wallet_test_fixture.h:25
node::NodeContext::chain
std::unique_ptr< interfaces::Chain > chain
Definition: context.h:51