rpc: Add EnsureArgsman helper

This commit is contained in:
MarcoFalke committed 2022-01-02 10:29:11 +01:00
1 parent 8b5a4de904
commit fa98b6f644
3 files changed
+18 -3

No files matched your search

-1
View File
@@ -21,7 +21,6 @@ class CBlock;
class CBlockIndex;
class CChainState;
class CTxMemPool;
class ChainstateManager;
class UniValue;
struct NodeContext;
+13
View File
@@ -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) {
+5 -2
View File
@@ -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);