Skip to content

Commit 91aae7b

Browse files
committed
refactor: use properly RPCHelpMan for governance RPC getsuperblockbudget
1 parent e92e5ef commit 91aae7b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/rpc/governance.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,9 +1026,9 @@ static RPCHelpMan getgovernanceinfo()
10261026
};
10271027
}
10281028

1029-
static UniValue getsuperblockbudget(const JSONRPCRequest& request)
1029+
static RPCHelpMan getsuperblockbudget()
10301030
{
1031-
RPCHelpMan{"getsuperblockbudget",
1031+
return RPCHelpMan{"getsuperblockbudget",
10321032
"\nReturns the absolute maximum sum of superblock payments allowed.\n",
10331033
{
10341034
{"index", RPCArg::Type::NUM, RPCArg::Optional::NO, "The block index"},
@@ -1040,16 +1040,19 @@ static UniValue getsuperblockbudget(const JSONRPCRequest& request)
10401040
HelpExampleCli("getsuperblockbudget", "1000")
10411041
+ HelpExampleRpc("getsuperblockbudget", "1000")
10421042
},
1043-
}.Check(request);
1044-
1043+
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
1044+
{
10451045
int nBlockHeight = request.params[0].get_int();
10461046
if (nBlockHeight < 0) {
10471047
throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range");
10481048
}
10491049

10501050
const ChainstateManager& chainman = EnsureAnyChainman(request.context);
10511051
return ValueFromAmount(CSuperblock::GetPaymentsLimit(chainman.ActiveChain(), nBlockHeight));
1052+
},
1053+
};
10521054
}
1055+
10531056
void RegisterGovernanceRPCCommands(CRPCTable &t)
10541057
{
10551058
// clang-format off

0 commit comments

Comments
 (0)