diff options
-rw-r--r-- | src/validation.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index a5b68e4ebd..b589674766 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1927,6 +1927,8 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state, uint256 hashPrevBlock = pindex->pprev == nullptr ? uint256() : pindex->pprev->GetBlockHash(); assert(hashPrevBlock == view.GetBestBlock()); + nBlocksTotal++; + // Special case for the genesis block, skipping connection of its transactions // (its coinbase is unspendable) if (block.GetHash() == chainparams.GetConsensus().hashGenesisBlock) { @@ -1935,8 +1937,6 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state, return true; } - nBlocksTotal++; - bool fScriptChecks = true; if (!hashAssumeValid.IsNull()) { // We've been configured with the hash of a block which has been externally verified to have a valid history. @@ -2598,6 +2598,7 @@ bool CChainState::ConnectTip(BlockValidationState& state, const CChainParams& ch return error("%s: ConnectBlock %s failed, %s", __func__, pindexNew->GetBlockHash().ToString(), state.ToString()); } nTime3 = GetTimeMicros(); nTimeConnectTotal += nTime3 - nTime2; + assert(nBlocksTotal > 0); LogPrint(BCLog::BENCH, " - Connect total: %.2fms [%.2fs (%.2fms/blk)]\n", (nTime3 - nTime2) * MILLI, nTimeConnectTotal * MICRO, nTimeConnectTotal * MILLI / nBlocksTotal); bool flushed = view.Flush(); assert(flushed); |