@@ -2463,8 +2463,8 @@ bool CChainState::FlushStateToDisk(
24632463 // Flush best chain related state. This can only be done if the blocks / block index write was also done.
24642464 if (fDoFullFlush && !CoinsTip ().GetBestBlock ().IsNull ()) {
24652465 {
2466- LOG_TIME_SECONDS (strprintf (" write coins cache to disk (%d coins, %.2fkB)" ,
2467- coins_count, coins_mem_usage / 1000 ));
2466+ LOG_TIME_MILLIS_WITH_CATEGORY (strprintf (" write coins cache to disk (%d coins, %.2fkB)" ,
2467+ coins_count, coins_mem_usage / 1000 ), BCLog::BENCHMARK );
24682468
24692469 // Typical Coin structures on disk are around 48 bytes in size.
24702470 // Pushing a new one to the database can cause it to be written
@@ -3756,7 +3756,7 @@ bool ChainstateManager::AcceptBlockHeader(const CBlockHeader& block, BlockValida
37563756 if (ppindex)
37573757 *ppindex = pindex;
37583758 if (pindex->nStatus & BLOCK_FAILED_MASK) {
3759- LogPrintf ( " ERROR: %s: block %s is marked invalid\n " , __func__, hash.ToString ());
3759+ LogPrint (BCLog::VALIDATION, " %s: block %s is marked invalid\n " , __func__, hash.ToString ());
37603760 return state.Invalid (BlockValidationResult::BLOCK_CACHED_INVALID, " duplicate" );
37613761 }
37623762 if (pindex->nStatus & BLOCK_CONFLICT_CHAINLOCK) {
@@ -3775,25 +3775,26 @@ bool ChainstateManager::AcceptBlockHeader(const CBlockHeader& block, BlockValida
37753775 CBlockIndex* pindexPrev = nullptr ;
37763776 BlockMap::iterator mi{m_blockman.m_block_index .find (block.hashPrevBlock )};
37773777 if (mi == m_blockman.m_block_index .end ()) {
3778- LogPrintf ( " ERROR: %s: prev block not found\n " , __func__);
3778+ LogPrint (BCLog::VALIDATION, " %s: %s prev block not found\n " , __func__, hash. ToString () );
37793779 return state.Invalid (BlockValidationResult::BLOCK_MISSING_PREV, " prev-blk-not-found" );
37803780 }
37813781 pindexPrev = &((*mi).second );
37823782 assert (pindexPrev);
37833783
37843784 if (pindexPrev->nStatus & BLOCK_FAILED_MASK) {
3785- LogPrintf ( " ERROR: %s: prev block invalid\n " , __func__);
3785+ LogPrint (BCLog::VALIDATION, " %s: %s prev block invalid\n " , __func__, hash. ToString () );
37863786 return state.Invalid (BlockValidationResult::BLOCK_INVALID_PREV, " bad-prevblk" );
37873787 }
37883788
37893789 if (pindexPrev->nStatus & BLOCK_CONFLICT_CHAINLOCK) {
37903790 // it's ok-ish, the other node is probably missing the latest chainlock
3791- LogPrintf ( " ERROR: %s: prev block %s conflicts with chainlock\n " , __func__, block.hashPrevBlock .ToString ());
3791+ LogPrint (BCLog::VALIDATION, " %s: prev block %s conflicts with chainlock\n " , __func__, block.hashPrevBlock .ToString ());
37923792 return state.Invalid (BlockValidationResult::BLOCK_CHAINLOCK, " bad-prevblk-chainlock" );
37933793 }
37943794
37953795 if (!ContextualCheckBlockHeader (block, state, m_blockman, chainparams, pindexPrev, GetAdjustedTime ())) {
3796- return error (" %s: Consensus::ContextualCheckBlockHeader: %s, %s" , __func__, hash.ToString (), state.ToString ());
3796+ LogPrint (BCLog::VALIDATION, " %s: Consensus::ContextualCheckBlockHeader: %s, %s\n " , __func__, hash.ToString (), state.ToString ());
3797+ return false ;
37973798 }
37983799
37993800 /* Determine if this block descends from any block which has been found
@@ -3829,7 +3830,7 @@ bool ChainstateManager::AcceptBlockHeader(const CBlockHeader& block, BlockValida
38293830 m_blockman.m_dirty_blockindex .insert (invalid_walk);
38303831 invalid_walk = invalid_walk->pprev ;
38313832 }
3832- LogPrintf ( " ERROR: %s: prev block invalid\n " , __func__);
3833+ LogPrint (BCLog::VALIDATION, " %s: %s prev block invalid\n " , __func__, hash. ToString () );
38333834 return state.Invalid (BlockValidationResult::BLOCK_INVALID_PREV, " bad-prevblk" );
38343835 }
38353836 }
0 commit comments