From 91aae7b2fef08f56e98a2658dd01d564add3701a Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Sun, 23 Jun 2024 02:41:42 +0700 Subject: [PATCH] refactor: use properly RPCHelpMan for governance RPC getsuperblockbudget --- src/rpc/governance.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/rpc/governance.cpp b/src/rpc/governance.cpp index a6290d2b8b..b06fae9287 100644 --- a/src/rpc/governance.cpp +++ b/src/rpc/governance.cpp @@ -1026,9 +1026,9 @@ static RPCHelpMan getgovernanceinfo() }; } -static UniValue getsuperblockbudget(const JSONRPCRequest& request) +static RPCHelpMan getsuperblockbudget() { - RPCHelpMan{"getsuperblockbudget", + return RPCHelpMan{"getsuperblockbudget", "\nReturns the absolute maximum sum of superblock payments allowed.\n", { {"index", RPCArg::Type::NUM, RPCArg::Optional::NO, "The block index"}, @@ -1040,8 +1040,8 @@ static UniValue getsuperblockbudget(const JSONRPCRequest& request) HelpExampleCli("getsuperblockbudget", "1000") + HelpExampleRpc("getsuperblockbudget", "1000") }, - }.Check(request); - + [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue +{ int nBlockHeight = request.params[0].get_int(); if (nBlockHeight < 0) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range"); @@ -1049,7 +1049,10 @@ static UniValue getsuperblockbudget(const JSONRPCRequest& request) const ChainstateManager& chainman = EnsureAnyChainman(request.context); return ValueFromAmount(CSuperblock::GetPaymentsLimit(chainman.ActiveChain(), nBlockHeight)); +}, + }; } + void RegisterGovernanceRPCCommands(CRPCTable &t) { // clang-format off