The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
woop/consensus/consensus_state.go

31 lines
581 B

package consensus
// State is the consensus state enum for both leader and validator
type State int
// Followings are the set of states of validators or leaders during consensus.
const (
Finished State = iota
AnnounceDone
6 years ago
PrepareDone
PreparedDone
CommitDone
6 years ago
CommittedDone
)
// Returns string name for the State enum
func (state State) String() string {
names := [...]string{
"Finished",
"AnnounceDone",
6 years ago
"PrepareDone",
"PreparedDone",
"CommitDone",
6 years ago
"CommittedDone"}
6 years ago
if state < Finished || state > CommittedDone {
return "Unknown"
}
return names[state]
}