refactor: add const and use ?: in rpc/blockhain for dash specific code

This commit is contained in:
Konstantin Akimov 2024-09-02 15:40:33 +07:00
parent 4c1e0348b3
commit 7be514c45c
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524

View File

@ -1932,14 +1932,8 @@ static RPCHelpMan getchaintips()
// Always report the currently active tip.
setTips.insert(active_chain.Tip());
int nBranchMin = -1;
int nCountMax = INT_MAX;
if(!request.params[0].isNull())
nCountMax = request.params[0].get_int();
if(!request.params[1].isNull())
nBranchMin = request.params[1].get_int();
int nCountMax{request.params[0].isNull() ? INT_MAX : request.params[0].get_int()};
const int nBranchMin{request.params[1].isNull() ? -1: request.params[1].get_int()};
/* Construct the output array. */
UniValue res(UniValue::VARR);