Bitcoin Core  0.19.99
P2P Digital Currency
wallet_test_fixture.h
Go to the documentation of this file.
1 // Copyright (c) 2016-2019 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 #ifndef BITCOIN_WALLET_TEST_WALLET_TEST_FIXTURE_H
6 #define BITCOIN_WALLET_TEST_WALLET_TEST_FIXTURE_H
7 
8 #include <test/util/setup_common.h>
9 
10 #include <interfaces/chain.h>
11 #include <interfaces/wallet.h>
12 #include <node/context.h>
13 #include <wallet/wallet.h>
14 
15 #include <memory>
16 
19 struct WalletTestingSetup: public TestingSetup {
20  explicit WalletTestingSetup(const std::string& chainName = CBaseChainParams::MAIN);
21 
23  std::unique_ptr<interfaces::Chain> m_chain = interfaces::MakeChain(m_node);
24  std::unique_ptr<interfaces::ChainClient> m_chain_client = interfaces::MakeWalletClient(*m_chain, {});
26 };
27 
28 #endif // BITCOIN_WALLET_TEST_WALLET_TEST_FIXTURE_H
std::unique_ptr< ChainClient > MakeWalletClient(Chain &chain, std::vector< std::string > wallet_filenames)
Return implementation of ChainClient interface for a wallet client.
Definition: wallet.cpp:543
std::unique_ptr< Chain > MakeChain(NodeContext &node)
Return implementation of Chain interface.
Definition: chain.cpp:378
static const std::string MAIN
Chain name strings.
std::unique_ptr< interfaces::Chain > m_chain
NodeContext struct containing references to chain state and connection state.
Definition: context.h:31
std::unique_ptr< interfaces::ChainClient > m_chain_client
Testing setup and teardown for wallet.
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:606
WalletTestingSetup(const std::string &chainName=CBaseChainParams::MAIN)