Bitcoin ABC 0.31.2
P2P Digital Currency
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
context.h
Go to the documentation of this file.
1// Copyright (c) 2020 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_CONTEXT_H
6#define BITCOIN_WALLET_CONTEXT_H
7
8#include <sync.h>
9
10#include <functional>
11#include <list>
12#include <memory>
13#include <vector>
14
15class ArgsManager;
16class CWallet;
17namespace interfaces {
18class Chain;
19class Wallet;
20} // namespace interfaces
21
23 std::function<void(std::unique_ptr<interfaces::Wallet> wallet)>;
24
37 // Currently a raw pointer because the memory is not managed by this struct
38 ArgsManager *args{nullptr};
39 // It is unsafe to lock this after locking a CWallet::cs_wallet mutex
40 // because this could introduce inconsistent lock ordering and cause
41 // deadlocks.
43 std::vector<std::shared_ptr<CWallet>> wallets GUARDED_BY(wallets_mutex);
44 std::list<LoadWalletFn> wallet_load_fns GUARDED_BY(wallets_mutex);
45
51};
52
53#endif // BITCOIN_WALLET_CONTEXT_H
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:269
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
Definition: chain.h:136
WalletContext struct containing references to state shared between CWallet instances,...
Definition: context.h:35
ArgsManager * args
Definition: context.h:38
std::vector< std::shared_ptr< CWallet > > wallets GUARDED_BY(wallets_mutex)
WalletContext()
Declare default constructor and destructor that are not inline, so code instantiating the WalletConte...
Definition: context.cpp:7
std::list< LoadWalletFn > wallet_load_fns GUARDED_BY(wallets_mutex)
Mutex wallets_mutex
Definition: context.h:42
~WalletContext()
Definition: context.cpp:8
interfaces::Chain * chain
Definition: context.h:36
std::function< void(std::unique_ptr< interfaces::Wallet > wallet)> LoadWalletFn
Definition: context.h:23