rpc: Remove unnecessary casting of block height

This commit is contained in:
Carl Dong 2021-04-12 18:48:59 -04:00
parent 6a3d192020
commit f99913969f
2 changed files with 2 additions and 2 deletions

View file

@ -1369,7 +1369,7 @@ RPCHelpMan getblockchaininfo()
const int height = tip->nHeight; const int height = tip->nHeight;
UniValue obj(UniValue::VOBJ); UniValue obj(UniValue::VOBJ);
obj.pushKV("chain", Params().NetworkIDString()); obj.pushKV("chain", Params().NetworkIDString());
obj.pushKV("blocks", (int)height); obj.pushKV("blocks", height);
obj.pushKV("headers", pindexBestHeader ? pindexBestHeader->nHeight : -1); obj.pushKV("headers", pindexBestHeader ? pindexBestHeader->nHeight : -1);
obj.pushKV("bestblockhash", tip->GetBlockHash().GetHex()); obj.pushKV("bestblockhash", tip->GetBlockHash().GetHex());
obj.pushKV("difficulty", (double)GetDifficulty(tip)); obj.pushKV("difficulty", (double)GetDifficulty(tip));

View file

@ -434,7 +434,7 @@ static RPCHelpMan getmininginfo()
const CChain& active_chain = chainman.ActiveChain(); const CChain& active_chain = chainman.ActiveChain();
UniValue obj(UniValue::VOBJ); UniValue obj(UniValue::VOBJ);
obj.pushKV("blocks", (int)active_chain.Height()); obj.pushKV("blocks", active_chain.Height());
if (BlockAssembler::m_last_block_weight) obj.pushKV("currentblockweight", *BlockAssembler::m_last_block_weight); if (BlockAssembler::m_last_block_weight) obj.pushKV("currentblockweight", *BlockAssembler::m_last_block_weight);
if (BlockAssembler::m_last_block_num_txs) obj.pushKV("currentblocktx", *BlockAssembler::m_last_block_num_txs); if (BlockAssembler::m_last_block_num_txs) obj.pushKV("currentblocktx", *BlockAssembler::m_last_block_num_txs);
obj.pushKV("difficulty", (double)GetDifficulty(active_chain.Tip())); obj.pushKV("difficulty", (double)GetDifficulty(active_chain.Tip()));