From d5ae10dbc41272ba4bd7c407eb94c16b0bdae9d7 Mon Sep 17 00:00:00 2001 From: Rongjian Lan Date: Fri, 17 Aug 2018 15:39:07 -0700 Subject: [PATCH] Add state and consensus message type for commit phase of Cosi --- consensus/consensus_state.go | 12 ++++++++++-- proto/consensus/consensus.go | 8 ++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/consensus/consensus_state.go b/consensus/consensus_state.go index 921a81cb9..700d3dd76 100644 --- a/consensus/consensus_state.go +++ b/consensus/consensus_state.go @@ -13,6 +13,10 @@ const ( COMMIT_DONE CHALLENGE_DONE RESPONSE_DONE + COLLECTIVE_SIG_DONE + FINAL_COMMIT_DONE + FINAL_CHALLENGE_DONE + FINAL_RESPONSE_DONE ) // Returns string name for the ConsensusState enum @@ -22,9 +26,13 @@ func (state ConsensusState) String() string { "ANNOUNCE_DONE", "COMMIT_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 names[state] diff --git a/proto/consensus/consensus.go b/proto/consensus/consensus.go index 8609018a3..51c7e43ee 100644 --- a/proto/consensus/consensus.go +++ b/proto/consensus/consensus.go @@ -88,6 +88,10 @@ const ( COMMIT CHALLENGE RESPONSE + COLLECTIVE_SIG + FINAL_COMMIT + FINAL_CHALLENGE + FINAL_RESPONSE START_CONSENSUS ) @@ -98,6 +102,10 @@ func (msgType MessageType) String() string { "COMMIT", "CHALLENGE", "RESPONSE", + "COLLECTIVE_SIG", + "FINAL_COMMIT", + "FINAL_CHALLENGE", + "FINAL_RESPONSE", "START_CONSENSUS", }