aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/server_util.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2022-01-02 10:24:24 +0100
committerMarcoFalke <falke.marco@gmail.com>2022-01-02 10:29:11 +0100
commitfa98b6f6449d33b315a73156c6de968f1757d53a (patch)
treeb08d1af9e6c73b82774e4be011837ee36527e0e2 /src/rpc/server_util.cpp
parent8b5a4de904b414fb3a818732cd0a2c90b91bc275 (diff)
downloadbitcoin-fa98b6f6449d33b315a73156c6de968f1757d53a.tar.xz
rpc: Add EnsureArgsman helper
Diffstat (limited to 'src/rpc/server_util.cpp')
-rw-r--r--src/rpc/server_util.cpp13
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) {