mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
node: Add chainman alias for g_chainman
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user