Clean up consensus handler's switch clause

pull/61/head
Rongjian Lan 6 years ago
parent e0c250561d
commit 88ee34821c
  1. 4
      consensus/consensus_leader.go
  2. 4
      consensus/consensus_validator.go

@ -48,12 +48,8 @@ func (consensus *Consensus) ProcessMessageLeader(message []byte) {
} }
switch msgType { switch msgType {
case proto_consensus.ANNOUNCE:
consensus.Log.Error("Unexpected message type", "msgType", msgType, "consensus", consensus)
case proto_consensus.COMMIT: case proto_consensus.COMMIT:
consensus.processCommitMessage(payload) consensus.processCommitMessage(payload)
case proto_consensus.CHALLENGE:
consensus.Log.Error("Unexpected message type", "msgType", msgType, "consensus", consensus)
case proto_consensus.RESPONSE: case proto_consensus.RESPONSE:
consensus.processResponseMessage(payload) consensus.processResponseMessage(payload)
case proto_consensus.START_CONSENSUS: case proto_consensus.START_CONSENSUS:

@ -30,12 +30,8 @@ func (consensus *Consensus) ProcessMessageValidator(message []byte) {
switch msgType { switch msgType {
case proto_consensus.ANNOUNCE: case proto_consensus.ANNOUNCE:
consensus.processAnnounceMessage(payload) consensus.processAnnounceMessage(payload)
case proto_consensus.COMMIT:
consensus.Log.Error("Unexpected message type", "msgType", msgType, "consensus", consensus)
case proto_consensus.CHALLENGE: case proto_consensus.CHALLENGE:
consensus.processChallengeMessage(payload) consensus.processChallengeMessage(payload)
case proto_consensus.RESPONSE:
consensus.Log.Error("Unexpected message type", "msgType", msgType, "consensus", consensus)
default: default:
consensus.Log.Error("Unexpected message type", "msgType", msgType, "consensus", consensus) consensus.Log.Error("Unexpected message type", "msgType", msgType, "consensus", consensus)
} }

Loading…
Cancel
Save