raft: return error if block processing is aborted

This commit is contained in:
amalraj.manigmail.com 2020-05-08 16:51:09 +08:00 committed by Trung Nguyen
parent 3ae914052f
commit 1d23f35b99
No known key found for this signature in database
GPG Key ID: 4636434ED9505EB7
1 changed files with 6 additions and 0 deletions

View File

@ -1557,6 +1557,12 @@ func mergeReceipts(pub, priv types.Receipts) types.Receipts {
func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, []interface{}, []*types.Log, error) {
// If the chain is terminating, don't even bother starting up
if atomic.LoadInt32(&bc.procInterrupt) == 1 {
log.Debug("Premature abort during blocks processing")
// QUORUM
if bc.isRaft() {
// Only returns an error for raft mode
return 0, nil, nil, ErrAbortBlocksProcessing
}
return 0, nil, nil, nil
}
// Start a parallel signature recovery (signer will fluke on fork transition, minimal perf loss)