[viewchange] ignore viewchange/newview messages if not in viewchanging mode

Signed-off-by: Leo Chen <leo@harmony.one>
pull/3388/head
Leo Chen 4 years ago
parent 92130a2ba3
commit cadec98dd9
  1. 7
      consensus/consensus_v2.go

@ -43,6 +43,13 @@ func (consensus *Consensus) HandleMessageUpdate(ctx context.Context, msg *msg_pb
return nil return nil
} }
// when node is not in ViewChanging mode, ignore viewchange / newview messages
if !consensus.IsViewChangingMode() &&
(msg.Type == msg_pb.MessageType_VIEWCHANGE ||
msg.Type == msg_pb.MessageType_NEWVIEW) {
return nil
}
intendedForValidator, intendedForLeader := intendedForValidator, intendedForLeader :=
!consensus.IsLeader(), !consensus.IsLeader(),
consensus.IsLeader() consensus.IsLeader()

Loading…
Cancel
Save