mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
rpc: Add EnsureArgsman helper
This commit is contained in:
parent
8b5a4de904
commit
fa98b6f644
3 changed files with 18 additions and 3 deletions
|
@ -21,7 +21,6 @@ class CBlock;
|
|||
class CBlockIndex;
|
||||
class CChainState;
|
||||
class CTxMemPool;
|
||||
class ChainstateManager;
|
||||
class UniValue;
|
||||
struct NodeContext;
|
||||
|
||||
|
|
|
@ -37,6 +37,19 @@ CTxMemPool& EnsureAnyMemPool(const std::any& 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)
|
||||
{
|
||||
if (!node.chainman) {
|
||||
|
|
|
@ -7,16 +7,19 @@
|
|||
|
||||
#include <any>
|
||||
|
||||
class ArgsManager;
|
||||
class CBlockPolicyEstimator;
|
||||
class CConnman;
|
||||
class ChainstateManager;
|
||||
class CTxMemPool;
|
||||
struct NodeContext;
|
||||
class ChainstateManager;
|
||||
class PeerManager;
|
||||
struct NodeContext;
|
||||
|
||||
NodeContext& EnsureAnyNodeContext(const std::any& context);
|
||||
CTxMemPool& EnsureMemPool(const NodeContext& node);
|
||||
CTxMemPool& EnsureAnyMemPool(const std::any& context);
|
||||
ArgsManager& EnsureArgsman(const NodeContext& node);
|
||||
ArgsManager& EnsureAnyArgsman(const std::any& context);
|
||||
ChainstateManager& EnsureChainman(const NodeContext& node);
|
||||
ChainstateManager& EnsureAnyChainman(const std::any& context);
|
||||
CBlockPolicyEstimator& EnsureFeeEstimator(const NodeContext& node);
|
||||
|
|
Loading…
Add table
Reference in a new issue