@ -1914,7 +1914,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
REJECT_INVALID , " bad-cb-amount " ) ;
REJECT_INVALID , " bad-cb-amount " ) ;
if ( ! control . Wait ( ) )
if ( ! control . Wait ( ) )
return state . DoS ( 100 , false ) ;
return state . DoS ( 100 , error ( " %s: CheckQueue failed " , __func__ ) , REJECT_INVALID , " block-validation-failed " ) ;
int64_t nTime4 = GetTimeMicros ( ) ; nTimeVerify + = nTime4 - nTime2 ;
int64_t nTime4 = GetTimeMicros ( ) ; nTimeVerify + = nTime4 - nTime2 ;
LogPrint ( BCLog : : BENCH , " - Verify %u txins: %.2fms (%.3fms/txin) [%.2fs] \n " , nInputs - 1 , 0.001 * ( nTime4 - nTime2 ) , nInputs < = 1 ? 0 : 0.001 * ( nTime4 - nTime2 ) / ( nInputs - 1 ) , nTimeVerify * 0.000001 ) ;
LogPrint ( BCLog : : BENCH , " - Verify %u txins: %.2fms (%.3fms/txin) [%.2fs] \n " , nInputs - 1 , 0.001 * ( nTime4 - nTime2 ) , nInputs < = 1 ? 0 : 0.001 * ( nTime4 - nTime2 ) / ( nInputs - 1 ) , nTimeVerify * 0.000001 ) ;
@ -2882,10 +2882,12 @@ static bool CheckIndexAgainstCheckpoint(const CBlockIndex* pindexPrev, CValidati
return true ;
return true ;
int nHeight = pindexPrev - > nHeight + 1 ;
int nHeight = pindexPrev - > nHeight + 1 ;
// Don't accept any forks from the main chain prior to last checkpoint
// Don't accept any forks from the main chain prior to last checkpoint.
// GetLastCheckpoint finds the last checkpoint in MapCheckpoints that's in our
// MapBlockIndex.
CBlockIndex * pcheckpoint = Checkpoints : : GetLastCheckpoint ( chainparams . Checkpoints ( ) ) ;
CBlockIndex * pcheckpoint = Checkpoints : : GetLastCheckpoint ( chainparams . Checkpoints ( ) ) ;
if ( pcheckpoint & & nHeight < pcheckpoint - > nHeight )
if ( pcheckpoint & & nHeight < pcheckpoint - > nHeight )
return state . DoS ( 100 , error ( " %s: forked chain older than last checkpoint (height %d) " , __func__ , nHeight ) ) ;
return state . DoS ( 100 , error ( " %s: forked chain older than last checkpoint (height %d) " , __func__ , nHeight ) , REJECT_CHECKPOINT , " bad-fork-prior-to-checkpoint " ) ;
return true ;
return true ;
}
}
@ -3086,7 +3088,7 @@ static bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state
CBlockIndex * pindexPrev = NULL ;
CBlockIndex * pindexPrev = NULL ;
BlockMap : : iterator mi = mapBlockIndex . find ( block . hashPrevBlock ) ;
BlockMap : : iterator mi = mapBlockIndex . find ( block . hashPrevBlock ) ;
if ( mi = = mapBlockIndex . end ( ) )
if ( mi = = mapBlockIndex . end ( ) )
return state . DoS ( 10 , error ( " %s: prev block not found " , __func__ ) , 0 , " bad- prevblk" ) ;
return state . DoS ( 10 , error ( " %s: prev block not found " , __func__ ) , 0 , " prev- blk-not-found " ) ;
pindexPrev = ( * mi ) . second ;
pindexPrev = ( * mi ) . second ;
if ( pindexPrev - > nStatus & BLOCK_FAILED_MASK )
if ( pindexPrev - > nStatus & BLOCK_FAILED_MASK )
return state . DoS ( 100 , error ( " %s: prev block invalid " , __func__ ) , REJECT_INVALID , " bad-prevblk " ) ;
return state . DoS ( 100 , error ( " %s: prev block invalid " , __func__ ) , REJECT_INVALID , " bad-prevblk " ) ;