@@ -58,7 +58,7 @@ static CUpdatedBlock latestblock;
5858 */
5959double GetDifficulty (const CBlockIndex* blockindex)
6060{
61- assert (blockindex);
61+ CHECK_NONFATAL (blockindex);
6262
6363 int nShift = (blockindex->nBits >> 24 ) & 0xff ;
6464 double dDiff =
@@ -957,7 +957,7 @@ static UniValue pruneblockchain(const JSONRPCRequest& request)
957957
958958 PruneBlockFilesManual (height);
959959 const CBlockIndex* block = ::ChainActive ().Tip ();
960- assert (block);
960+ CHECK_NONFATAL (block);
961961 while (block->pprev && (block->pprev ->nStatus & BLOCK_HAVE_DATA)) {
962962 block = block->pprev ;
963963 }
@@ -1252,7 +1252,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
12521252 obj.pushKV (" pruned" , fPruneMode );
12531253 if (fPruneMode ) {
12541254 const CBlockIndex* block = tip;
1255- assert (block);
1255+ CHECK_NONFATAL (block);
12561256 while (block->pprev && (block->pprev ->nStatus & BLOCK_HAVE_DATA)) {
12571257 block = block->pprev ;
12581258 }
@@ -1598,7 +1598,7 @@ static UniValue getchaintxstats(const JSONRPCRequest& request)
15981598 }
15991599 }
16001600
1601- assert (pindex != nullptr );
1601+ CHECK_NONFATAL (pindex != nullptr );
16021602
16031603 if (request.params [0 ].isNull ()) {
16041604 blockcount = std::max (0 , std::min (blockcount, pindex->nHeight - 1 ));
@@ -1771,7 +1771,7 @@ static UniValue getblockstats(const JSONRPCRequest& request)
17711771 }
17721772 }
17731773
1774- assert (pindex != nullptr );
1774+ CHECK_NONFATAL (pindex != nullptr );
17751775
17761776 std::set<std::string> stats;
17771777 if (!request.params [1 ].isNull ()) {
@@ -1871,7 +1871,7 @@ static UniValue getblockstats(const JSONRPCRequest& request)
18711871 }
18721872
18731873 CAmount txfee = tx_total_in - tx_total_out;
1874- assert (MoneyRange (txfee));
1874+ CHECK_NONFATAL (MoneyRange (txfee));
18751875 if (do_medianfee) {
18761876 fee_array.push_back (txfee);
18771877 }
@@ -2008,7 +2008,7 @@ class CoinsViewScanReserver
20082008 explicit CoinsViewScanReserver () : m_could_reserve(false ) {}
20092009
20102010 bool reserve () {
2011- assert (!m_could_reserve);
2011+ CHECK_NONFATAL (!m_could_reserve);
20122012 std::lock_guard<std::mutex> lock (g_utxosetscan);
20132013 if (g_scan_in_progress) {
20142014 return false ;
@@ -2135,9 +2135,9 @@ UniValue scantxoutset(const JSONRPCRequest& request)
21352135 LOCK (cs_main);
21362136 ::ChainstateActive ().ForceFlushStateToDisk();
21372137 pcursor = std::unique_ptr<CCoinsViewCursor>(::ChainstateActive ().CoinsDB ().Cursor ());
2138- assert (pcursor);
2138+ CHECK_NONFATAL (pcursor);
21392139 tip = ::ChainActive ().Tip ();
2140- assert (tip);
2140+ CHECK_NONFATAL (tip);
21412141 }
21422142 bool res = FindScriptPubKey (g_scan_progress, g_should_abort_scan, count, pcursor.get (), needles, coins);
21432143 result.pushKV (" success" , res);
0 commit comments