Bitcoin Core
24.1.0
P2P Digital Currency
src
wallet
test
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
5
#include <
wallet/test/wallet_test_fixture.h
>
6
7
#include <
scheduler.h
>
8
9
namespace
wallet
{
10
WalletTestingSetup::WalletTestingSetup
(
const
std::string& chainName)
11
:
TestingSetup
(chainName),
12
m_wallet_loader{
interfaces::MakeWalletLoader
(*
m_node
.
chain
, *
Assert
(
m_node
.
args
))},
13
m_wallet
(
m_node
.
chain
.get(),
""
, m_args,
CreateMockWalletDatabase
())
14
{
15
m_wallet
.LoadWallet();
16
m_chain_notifications_handler =
m_node
.
chain
->handleNotifications({ &
m_wallet
, [](
CWallet
*) {} });
17
m_wallet_loader->registerRpcs();
18
}
19
20
WalletTestingSetup::~WalletTestingSetup
()
21
{
22
if
(
m_node
.
scheduler
)
m_node
.
scheduler
->stop();
23
}
24
}
// namespace wallet
node::NodeContext::chain
std::unique_ptr< interfaces::Chain > chain
Definition:
context.h:57
m_node
node::NodeContext m_node
Definition:
bitcoin-gui.cpp:37
wallet::WalletTestingSetup::~WalletTestingSetup
~WalletTestingSetup()
Definition:
wallet_test_fixture.cpp:20
m_wallet
std::shared_ptr< CWallet > m_wallet
Definition:
interfaces.cpp:521
node::NodeContext::scheduler
std::unique_ptr< CScheduler > scheduler
Definition:
context.h:63
scheduler.h
interfaces::MakeWalletLoader
std::unique_ptr< WalletLoader > MakeWalletLoader(Chain &chain, ArgsManager &args)
Return implementation of ChainClient interface for a wallet loader.
Definition:
dummywallet.cpp:62
wallet::CreateMockWalletDatabase
std::unique_ptr< WalletDatabase > CreateMockWalletDatabase(DatabaseOptions &options)
Return object for accessing temporary in-memory database.
Definition:
walletdb.cpp:1242
node::NodeContext::args
ArgsManager * args
Definition:
context.h:56
wallet::CWallet
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition:
wallet.h:235
wallet
Definition:
node.h:39
wallet_test_fixture.h
wallet::WalletTestingSetup::WalletTestingSetup
WalletTestingSetup(const std::string &chainName=CBaseChainParams::MAIN)
Definition:
wallet_test_fixture.cpp:10
BasicTestingSetup::m_node
node::NodeContext m_node
Definition:
setup_common.h:84
TestingSetup
Testing setup that configures a complete environment.
Definition:
setup_common.h:109
Assert
#define Assert(val)
Identity function.
Definition:
check.h:74
Generated on Tue May 16 2023 12:00:00 for Bitcoin Core by
1.8.14