Add state and consensus message type for commit phase of Cosi

pull/61/head
Rongjian Lan 6 years ago
parent 869c11fbc6
commit d5ae10dbc4
  1. 12
      consensus/consensus_state.go
  2. 8
      proto/consensus/consensus.go

@ -13,6 +13,10 @@ const (
COMMIT_DONE COMMIT_DONE
CHALLENGE_DONE CHALLENGE_DONE
RESPONSE_DONE RESPONSE_DONE
COLLECTIVE_SIG_DONE
FINAL_COMMIT_DONE
FINAL_CHALLENGE_DONE
FINAL_RESPONSE_DONE
) )
// Returns string name for the ConsensusState enum // Returns string name for the ConsensusState enum
@ -22,9 +26,13 @@ func (state ConsensusState) String() string {
"ANNOUNCE_DONE", "ANNOUNCE_DONE",
"COMMIT_DONE", "COMMIT_DONE",
"CHALLENGE_DONE", "CHALLENGE_DONE",
"RESPONSE_DONE"} "RESPONSE_DONE",
"COLLECTIVE_SIG_DONE",
"FINAL_COMMIT_DONE",
"FINAL_CHALLENGE_DONE",
"FINAL_RESPONSE_DONE"}
if state < FINISHED || state > RESPONSE_DONE { if state < FINISHED || state > FINAL_RESPONSE_DONE {
return "Unknown" return "Unknown"
} }
return names[state] return names[state]

@ -88,6 +88,10 @@ const (
COMMIT COMMIT
CHALLENGE CHALLENGE
RESPONSE RESPONSE
COLLECTIVE_SIG
FINAL_COMMIT
FINAL_CHALLENGE
FINAL_RESPONSE
START_CONSENSUS START_CONSENSUS
) )
@ -98,6 +102,10 @@ func (msgType MessageType) String() string {
"COMMIT", "COMMIT",
"CHALLENGE", "CHALLENGE",
"RESPONSE", "RESPONSE",
"COLLECTIVE_SIG",
"FINAL_COMMIT",
"FINAL_CHALLENGE",
"FINAL_RESPONSE",
"START_CONSENSUS", "START_CONSENSUS",
} }

Loading…
Cancel
Save