diff options
author | MarcoFalke <falke.marco@gmail.com> | 2022-01-02 10:24:24 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2022-01-02 10:29:11 +0100 |
commit | fa98b6f6449d33b315a73156c6de968f1757d53a (patch) | |
tree | b08d1af9e6c73b82774e4be011837ee36527e0e2 /src/rpc/server_util.cpp | |
parent | 8b5a4de904b414fb3a818732cd0a2c90b91bc275 (diff) |
rpc: Add EnsureArgsman helper
Diffstat (limited to 'src/rpc/server_util.cpp')
-rw-r--r-- | src/rpc/server_util.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/rpc/server_util.cpp b/src/rpc/server_util.cpp index 3fc35222e1..2978051574 100644 --- a/src/rpc/server_util.cpp +++ b/src/rpc/server_util.cpp @@ -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) { |