Skip to content

Commit

Permalink
Old calibrate event not to return error (#1570)
Browse files Browse the repository at this point in the history
* change old eCalibrate error to debug logging
  • Loading branch information
koseoyoung authored Oct 25, 2019
1 parent 3190984 commit 1da4e75
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion consensus/consensusfsm/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ var (
ErrEvtConvert = errors.New("error when converting the event from/to the proto message")
// ErrEvtType represents an unexpected event type error
ErrEvtType = errors.New("error when check the event type")
// ErrOldCalibrateEvt indicates the error of ignoring old calibrate event
ErrOldCalibrateEvt = errors.New("ignore old calibrate event")

// consensusStates is a slice consisting of all consensus states
consensusStates = []fsm.State{
Expand Down Expand Up @@ -347,6 +349,11 @@ func (m *ConsensusFSM) handle(evt *ConsensusEvent) error {
zap.Error(err),
)
consensusEvtsMtc.WithLabelValues(string(evt.Type()), "backoff").Inc()
case ErrOldCalibrateEvt:
m.ctx.Logger().Debug(
"failed to handle eCalibrate, event height is less than current height",
zap.Error(err),
)
default:
return errors.Wrapf(
err,
Expand All @@ -369,7 +376,7 @@ func (m *ConsensusFSM) calibrate(evt fsm.Event) (fsm.State, error) {
}
consensusHeight := m.ctx.Height()
if consensusHeight > height {
return sPrepare, errors.New("ignore old calibrate event")
return sPrepare, ErrOldCalibrateEvt
}
m.ctx.Logger().Debug(
"Calibrate consensus context",
Expand Down

0 comments on commit 1da4e75

Please sign in to comment.