3737#include < txmempool.h>
3838#include < undo.h>
3939#include < univalue.h>
40+ #include < util/check.h>
4041#include < util/strencodings.h>
4142#include < util/translation.h>
4243#include < validation.h>
@@ -786,8 +787,7 @@ static RPCHelpMan pruneblockchain()
786787 }
787788
788789 PruneBlockFilesManual (active_chainstate, height);
789- const CBlockIndex* block = active_chain.Tip ();
790- CHECK_NONFATAL (block);
790+ const CBlockIndex* block = CHECK_NONFATAL (active_chain.Tip ());
791791 while (block->pprev && (block->pprev ->nStatus & BLOCK_HAVE_DATA)) {
792792 block = block->pprev ;
793793 }
@@ -1201,8 +1201,7 @@ RPCHelpMan getblockchaininfo()
12011201 LOCK (cs_main);
12021202 CChainState& active_chainstate = chainman.ActiveChainstate ();
12031203
1204- const CBlockIndex* tip = active_chainstate.m_chain .Tip ();
1205- CHECK_NONFATAL (tip);
1204+ const CBlockIndex* tip = CHECK_NONFATAL (active_chainstate.m_chain .Tip ());
12061205 const int height = tip->nHeight ;
12071206 UniValue obj (UniValue::VOBJ);
12081207 obj.pushKV (" chain" , Params ().NetworkIDString ());
@@ -1218,8 +1217,7 @@ RPCHelpMan getblockchaininfo()
12181217 obj.pushKV (" size_on_disk" , chainman.m_blockman .CalculateCurrentUsage ());
12191218 obj.pushKV (" pruned" , node::fPruneMode );
12201219 if (node::fPruneMode ) {
1221- const CBlockIndex* block = tip;
1222- CHECK_NONFATAL (block);
1220+ const CBlockIndex* block = CHECK_NONFATAL (tip);
12231221 while (block->pprev && (block->pprev ->nStatus & BLOCK_HAVE_DATA)) {
12241222 block = block->pprev ;
12251223 }
@@ -1310,8 +1308,7 @@ static RPCHelpMan getdeploymentinfo()
13101308
13111309 const CBlockIndex* blockindex;
13121310 if (request.params [0 ].isNull ()) {
1313- blockindex = active_chainstate.m_chain .Tip ();
1314- CHECK_NONFATAL (blockindex);
1311+ blockindex = CHECK_NONFATAL (active_chainstate.m_chain .Tip ());
13151312 } else {
13161313 const uint256 hash (ParseHashV (request.params [0 ], " blockhash" ));
13171314 blockindex = chainman.m_blockman .LookupBlockIndex (hash);
@@ -2132,10 +2129,8 @@ static RPCHelpMan scantxoutset()
21322129 LOCK (cs_main);
21332130 CChainState& active_chainstate = chainman.ActiveChainstate ();
21342131 active_chainstate.ForceFlushStateToDisk ();
2135- pcursor = active_chainstate.CoinsDB ().Cursor ();
2136- CHECK_NONFATAL (pcursor);
2137- tip = active_chainstate.m_chain .Tip ();
2138- CHECK_NONFATAL (tip);
2132+ pcursor = CHECK_NONFATAL (active_chainstate.CoinsDB ().Cursor ());
2133+ tip = CHECK_NONFATAL (active_chainstate.m_chain .Tip ());
21392134 }
21402135 bool res = FindScriptPubKey (g_scan_progress, g_should_abort_scan, count, pcursor.get (), needles, coins, node.rpc_interruption_point );
21412136 result.pushKV (" success" , res);
@@ -2337,8 +2332,7 @@ UniValue CreateUTXOSnapshot(
23372332 }
23382333
23392334 pcursor = chainstate.CoinsDB ().Cursor ();
2340- tip = chainstate.m_blockman .LookupBlockIndex (stats.hashBlock );
2341- CHECK_NONFATAL (tip);
2335+ tip = CHECK_NONFATAL (chainstate.m_blockman .LookupBlockIndex (stats.hashBlock ));
23422336 }
23432337
23442338 LOG_TIME_SECONDS (strprintf (" writing UTXO snapshot at height %s (%s) to file %s (via %s)" ,
0 commit comments