mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 10:19:26 +02:00
rpc: Add EnsureArgsman helper
This commit is contained in:
@ -21,7 +21,6 @@ class CBlock;
|
|||||||
class CBlockIndex;
|
class CBlockIndex;
|
||||||
class CChainState;
|
class CChainState;
|
||||||
class CTxMemPool;
|
class CTxMemPool;
|
||||||
class ChainstateManager;
|
|
||||||
class UniValue;
|
class UniValue;
|
||||||
struct NodeContext;
|
struct NodeContext;
|
||||||
|
|
||||||
|
@ -37,6 +37,19 @@ CTxMemPool& EnsureAnyMemPool(const std::any& context)
|
|||||||
return EnsureMemPool(EnsureAnyNodeContext(context));
|
return EnsureMemPool(EnsureAnyNodeContext(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ArgsManager& EnsureArgsman(const NodeContext& node)
|
||||||
|
{
|
||||||
|
if (!node.args) {
|
||||||
|
throw JSONRPCError(RPC_INTERNAL_ERROR, "Node args not found");
|
||||||
|
}
|
||||||
|
return *node.args;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArgsManager& EnsureAnyArgsman(const std::any& context)
|
||||||
|
{
|
||||||
|
return EnsureArgsman(EnsureAnyNodeContext(context));
|
||||||
|
}
|
||||||
|
|
||||||
ChainstateManager& EnsureChainman(const NodeContext& node)
|
ChainstateManager& EnsureChainman(const NodeContext& node)
|
||||||
{
|
{
|
||||||
if (!node.chainman) {
|
if (!node.chainman) {
|
||||||
|
@ -7,16 +7,19 @@
|
|||||||
|
|
||||||
#include <any>
|
#include <any>
|
||||||
|
|
||||||
|
class ArgsManager;
|
||||||
class CBlockPolicyEstimator;
|
class CBlockPolicyEstimator;
|
||||||
class CConnman;
|
class CConnman;
|
||||||
class ChainstateManager;
|
|
||||||
class CTxMemPool;
|
class CTxMemPool;
|
||||||
struct NodeContext;
|
class ChainstateManager;
|
||||||
class PeerManager;
|
class PeerManager;
|
||||||
|
struct NodeContext;
|
||||||
|
|
||||||
NodeContext& EnsureAnyNodeContext(const std::any& context);
|
NodeContext& EnsureAnyNodeContext(const std::any& context);
|
||||||
CTxMemPool& EnsureMemPool(const NodeContext& node);
|
CTxMemPool& EnsureMemPool(const NodeContext& node);
|
||||||
CTxMemPool& EnsureAnyMemPool(const std::any& context);
|
CTxMemPool& EnsureAnyMemPool(const std::any& context);
|
||||||
|
ArgsManager& EnsureArgsman(const NodeContext& node);
|
||||||
|
ArgsManager& EnsureAnyArgsman(const std::any& context);
|
||||||
ChainstateManager& EnsureChainman(const NodeContext& node);
|
ChainstateManager& EnsureChainman(const NodeContext& node);
|
||||||
ChainstateManager& EnsureAnyChainman(const std::any& context);
|
ChainstateManager& EnsureAnyChainman(const std::any& context);
|
||||||
CBlockPolicyEstimator& EnsureFeeEstimator(const NodeContext& node);
|
CBlockPolicyEstimator& EnsureFeeEstimator(const NodeContext& node);
|
||||||
|
Reference in New Issue
Block a user