1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
crate::ix!();
//-------------------------------------------[.cpp/bitcoin/src/node/context.h]
//-------------------------------------------[.cpp/bitcoin/src/node/context.cpp]
/**
| NodeContext struct containing references to
| chain state and connection state.
|
| This is used by init, rpc, and test code to
| pass object references around without needing
| to declare the same variables and parameters
| repeatedly, or to use globals.
|
| More variables could be added to this struct
| (particularly references to validation
| objects) to eliminate use of globals and make
| code more modular and testable. The struct
| isn't intended to have any member functions.
|
| It should just be a collection of references
| that can be used without pulling in unwanted
| dependencies or functionality.
*/
pub struct NodeContext {
/**
| Init interface for initializing current
| process and connecting to other processes.
|
*/
init: Rc<RefCell<dyn Init>>, // default = { nullptr }
addrman: Box<AddrMan>,
connman: Box<Connman>,
mempool: Box<TxMemPool>,
fee_estimator: Box<BlockPolicyEstimator>,
peerman: Box<PeerManager>,
chainman: Box<ChainstateManager>,
banman: Box<BanMan>,
/**
| Currently a raw pointer because the
| memory is not managed by this struct
|
*/
args: *mut ArgsManager, // default = { nullptr }
chain: Box<dyn ChainInterface>,
/**
| List of all chain clients (wallet processes
| or other client) connected to node.
|
*/
chain_clients: Vec<Box<dyn ChainClient>>,
/**
| Reference to chain client that should
| used to load or create wallets opened
| by the gui.
|
*/
wallet_client: Rc<RefCell<dyn WalletClient>>, // default = { nullptr }
scheduler: Box<Scheduler>,
rpc_interruption_point: fn() -> (), // default = noop
}
impl NodeContextInterface for NodeContext {}