From 7be514c45c7b8e686ecb85904767e94d41f5e345 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Mon, 2 Sep 2024 15:40:33 +0700 Subject: [PATCH] refactor: add const and use ?: in rpc/blockhain for dash specific code --- src/rpc/blockchain.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index c62b0e8e6e..e0bbea82af 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -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);