Improve import handling
Reduce rate of reimport (however, reimport was done very quickly).
Send prevote in prevoteWait step if import was done in the step.
@@ -635,7 +635,11 @@ func (cs *consensus) enterPrevote() {
cs.cancelBlockRequest = nil
}
- if cs.hrs != hrs || !cs.started {
+ late := cs.hrs.height != hrs.height ||
+ cs.hrs.round != hrs.round ||
+ cs.hrs.step >= stepCommit ||
+ !cs.started
+ if late {
return
}
@@ -646,11 +650,15 @@ func (cs *consensus) enterPrevote() {
if err == nil {
cs.currentBlockParts.validatedBlock = blk
+ if cs.hrs.step <= stepPrevoteWait {
cs.sendVote(voteTypePrevote, &cs.currentBlockParts)
+ }
} else {
cs.logger.Warnf("import cb error: %+v\n", err)
+ if cs.hrs.step <= stepPrevoteWait {
cs.sendVote(voteTypePrevote, nil)
}
+ }
},
)
if err != nil {
