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 class ArgsManager;
9 namespace interfaces {
10 class Chain;
11 } // namespace interfaces
12 
13 //! WalletContext struct containing references to state shared between CWallet
14 //! instances, like the reference to the chain interface, and the list of opened
15 //! wallets.
16 //!
17 //! Future shared state can be added here as an alternative to adding global
18 //! variables.
19 //!
20 //! The struct isn't intended to have any member functions. It should just be a
21 //! collection of state pointers that doesn't pull in dependencies or implement
22 //! behavior.
23 struct WalletContext {
24     interfaces::Chain* chain{nullptr};
25     ArgsManager* args{nullptr};
26 
27     //! Declare default constructor and destructor that are not inline, so code
28     //! instantiating the WalletContext struct doesn't need to #include class
29     //! definitions for smart pointer and container members.
30     WalletContext();
31     ~WalletContext();
32 };
33 
34 #endif // BITCOIN_WALLET_CONTEXT_H
35