Skip to content

Commit

Permalink
blockchain: Use iota for threshold states.
Browse files Browse the repository at this point in the history
The threshold states are no longer serialized to the database and thus
no longer are required to be stable.  This updates them to use iota
instead accordingly.
  • Loading branch information
davecgh committed Mar 5, 2023
1 parent 83b7f16 commit 2534bb7
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions internal/blockchain/thresholdstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,33 @@ import (
type ThresholdState byte

// These constants are used to identify specific threshold states.
//
// NOTE: This section specifically does not use iota for the individual states
// since these values are serialized and must be stable for long-term storage.
const (
// ThresholdDefined is the first state for each deployment and is the
// state for the genesis block has by definition for all deployments.
ThresholdDefined ThresholdState = 0
ThresholdDefined ThresholdState = iota

// ThresholdStarted is the state for a deployment once its start time
// has been reached.
ThresholdStarted ThresholdState = 1
ThresholdStarted

// ThresholdLockedIn is the state for a deployment during the retarget
// period which is after the ThresholdStarted state period and the
// number of blocks that have voted for the deployment equal or exceed
// the required number of votes for the deployment.
ThresholdLockedIn ThresholdState = 2
ThresholdLockedIn

// ThresholdActive is the state for a deployment for all blocks after a
// retarget period in which the deployment was in the ThresholdLockedIn
// state.
ThresholdActive ThresholdState = 3
ThresholdActive

// ThresholdFailed is the state for a deployment once its expiration
// time has been reached and it did not reach the ThresholdLockedIn
// state.
ThresholdFailed ThresholdState = 4
ThresholdFailed

// ThresholdInvalid is a deployment that does not exist.
ThresholdInvalid ThresholdState = 5
ThresholdInvalid
)

// thresholdStateStrings is a map of ThresholdState values back to their
Expand Down

0 comments on commit 2534bb7

Please sign in to comment.