@@ -1199,24 +1199,23 @@ RPCHelpMan getblockchaininfo()
1199
1199
LOCK (cs_main);
1200
1200
CChainState& active_chainstate = chainman.ActiveChainstate ();
1201
1201
1202
- const CBlockIndex* tip = CHECK_NONFATAL (active_chainstate.m_chain .Tip ());
1203
- const int height = tip-> nHeight ;
1202
+ const CBlockIndex& tip{* CHECK_NONFATAL (active_chainstate.m_chain .Tip ())} ;
1203
+ const int height{ tip. nHeight } ;
1204
1204
UniValue obj (UniValue::VOBJ);
1205
1205
obj.pushKV (" chain" , Params ().NetworkIDString ());
1206
1206
obj.pushKV (" blocks" , height);
1207
1207
obj.pushKV (" headers" , chainman.m_best_header ? chainman.m_best_header ->nHeight : -1 );
1208
- obj.pushKV (" bestblockhash" , tip-> GetBlockHash ().GetHex ());
1209
- obj.pushKV (" difficulty" , ( double ) GetDifficulty (tip));
1210
- obj.pushKV (" time" , ( int64_t ) tip-> nTime );
1211
- obj.pushKV (" mediantime" , ( int64_t ) tip-> GetMedianTimePast ());
1212
- obj.pushKV (" verificationprogress" , GuessVerificationProgress (Params ().TxData (), tip));
1208
+ obj.pushKV (" bestblockhash" , tip. GetBlockHash ().GetHex ());
1209
+ obj.pushKV (" difficulty" , GetDifficulty (& tip));
1210
+ obj.pushKV (" time" , int64_t { tip. nTime } );
1211
+ obj.pushKV (" mediantime" , tip. GetMedianTimePast ());
1212
+ obj.pushKV (" verificationprogress" , GuessVerificationProgress (Params ().TxData (), & tip));
1213
1213
obj.pushKV (" initialblockdownload" , active_chainstate.IsInitialBlockDownload ());
1214
- obj.pushKV (" chainwork" , tip-> nChainWork .GetHex ());
1214
+ obj.pushKV (" chainwork" , tip. nChainWork .GetHex ());
1215
1215
obj.pushKV (" size_on_disk" , chainman.m_blockman .CalculateCurrentUsage ());
1216
1216
obj.pushKV (" pruned" , node::fPruneMode );
1217
1217
if (node::fPruneMode ) {
1218
- const CBlockIndex* block = CHECK_NONFATAL (tip);
1219
- obj.pushKV (" pruneheight" , node::GetFirstStoredBlock (block)->nHeight );
1218
+ obj.pushKV (" pruneheight" , node::GetFirstStoredBlock (&tip)->nHeight );
1220
1219
1221
1220
// if 0, execution bypasses the whole if block.
1222
1221
bool automatic_pruning{args.GetIntArg (" -prune" , 0 ) != 1 };
@@ -1228,7 +1227,7 @@ RPCHelpMan getblockchaininfo()
1228
1227
1229
1228
if (IsDeprecatedRPCEnabled (" softforks" )) {
1230
1229
const Consensus::Params& consensusParams = Params ().GetConsensus ();
1231
- obj.pushKV (" softforks" , DeploymentInfo (tip, consensusParams));
1230
+ obj.pushKV (" softforks" , DeploymentInfo (& tip, consensusParams));
1232
1231
}
1233
1232
1234
1233
obj.pushKV (" warnings" , GetWarnings (false ).original );
0 commit comments