aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/server_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc/server_util.cpp')
-rw-r--r--src/rpc/server_util.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/rpc/server_util.cpp b/src/rpc/server_util.cpp
index 50f9ce7b3c..7a708ec813 100644
--- a/src/rpc/server_util.cpp
+++ b/src/rpc/server_util.cpp
@@ -39,6 +39,20 @@ CTxMemPool& EnsureAnyMemPool(const std::any& context)
return EnsureMemPool(EnsureAnyNodeContext(context));
}
+
+BanMan& EnsureBanman(const NodeContext& node)
+{
+ if (!node.banman) {
+ throw JSONRPCError(RPC_DATABASE_ERROR, "Error: Ban database not loaded");
+ }
+ return *node.banman;
+}
+
+BanMan& EnsureAnyBanman(const std::any& context)
+{
+ return EnsureBanman(EnsureAnyNodeContext(context));
+}
+
ArgsManager& EnsureArgsman(const NodeContext& node)
{
if (!node.args) {