diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-04-18 08:05:52 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-05-21 09:55:51 -0400 |
commit | fa7b626d7a150e5cbd4d163d2dab6f8a55fc2cc4 (patch) | |
tree | cdd1af4dac61f7738037603d88c19f25767e118a /src/node | |
parent | cfe22a5f9e1d9e2d3dc8ce177e6c8eb04bc96615 (diff) |
node: Add chainman alias for g_chainman
Diffstat (limited to 'src/node')
-rw-r--r-- | src/node/context.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/node/context.h b/src/node/context.h index 566ff170be..c45d9e6689 100644 --- a/src/node/context.h +++ b/src/node/context.h @@ -5,6 +5,7 @@ #ifndef BITCOIN_NODE_CONTEXT_H #define BITCOIN_NODE_CONTEXT_H +#include <cassert> #include <memory> #include <vector> @@ -13,6 +14,7 @@ class BanMan; class CConnman; class CScheduler; class CTxMemPool; +class ChainstateManager; class PeerLogicValidation; namespace interfaces { class Chain; @@ -33,6 +35,7 @@ struct NodeContext { std::unique_ptr<CConnman> connman; CTxMemPool* mempool{nullptr}; // Currently a raw pointer because the memory is not managed by this struct std::unique_ptr<PeerLogicValidation> peer_logic; + ChainstateManager* chainman{nullptr}; // Currently a raw pointer because the memory is not managed by this struct std::unique_ptr<BanMan> banman; ArgsManager* args{nullptr}; // Currently a raw pointer because the memory is not managed by this struct std::unique_ptr<interfaces::Chain> chain; @@ -46,4 +49,10 @@ struct NodeContext { ~NodeContext(); }; +inline ChainstateManager& EnsureChainman(const NodeContext& node) +{ + assert(node.chainman); + return *node.chainman; +} + #endif // BITCOIN_NODE_CONTEXT_H |