mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
net: add Ensure{any}Banman
it adds `Ensure{any}Banman` functions to avoid
code repetition and make it cleaner. Similar
approach as done with argsman, chainman, connman
and others.
This commit is contained in:
parent
fe86616bb4
commit
2d955ff006
3 changed files with 26 additions and 17 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue