Documentation ¶
Index ¶
- Variables
- func NewByteValue(val []byte) atomic.Value
- func NewHeight(height specqbft.Height) atomic.Value
- func NewRound(round specqbft.Round) atomic.Value
- func ReportDecided(pk string, msg *specqbft.SignedMessage)
- type InstanceConfig
- type RoundState
- type State
- func (s *State) GetHeight() specqbft.Height
- func (s *State) GetIdentifier() []byte
- func (s *State) GetInputValue() []byte
- func (s *State) GetPreparedRound() specqbft.Round
- func (s *State) GetPreparedValue() []byte
- func (s *State) GetProposalAcceptedForCurrentRound() *specqbft.SignedMessage
- func (s *State) GetRound() specqbft.Round
- func (s *State) MarshalJSON() ([]byte, error)
- func (s *State) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
var RoundStateName = map[int32]string{
0: "NotStarted",
1: "Proposal",
2: "Prepare",
3: "Commit",
4: "ChangeRound",
5: "Decided",
6: "Stopped",
}
RoundStateName represents the map of the round state names
Functions ¶
func NewByteValue ¶
NewByteValue returns a new byte value
func ReportDecided ¶
func ReportDecided(pk string, msg *specqbft.SignedMessage)
ReportDecided reports on a decided message
Types ¶
type InstanceConfig ¶
type InstanceConfig struct { RoundChangeDurationSeconds float32 LeaderProposalDelaySeconds float32 }
InstanceConfig is the configuration of the instance
func DefaultConsensusParams ¶
func DefaultConsensusParams() *InstanceConfig
DefaultConsensusParams returns the default round change duration time
type RoundState ¶
type RoundState int32
RoundState is the state of the round
const ( RoundStateNotStarted RoundState = iota RoundStateReady RoundStateProposal RoundStatePrepare RoundStateCommit RoundStateChangeRound RoundStateDecided RoundStateStopped )
RoundState values
type State ¶
type State struct { Stage atomic.Int32 // RoundState // Identifier is an instance unique identifier, much like a block hash in a blockchain Identifier atomic.Value // []byte // Height is an incremental number for each instance, much like a block number would be in a blockchain Height atomic.Value // specqbft.Height InputValue atomic.Value // []byte Round atomic.Value // specqbft.Round PreparedRound atomic.Value // specqbft.Round PreparedValue atomic.Value // []byte ProposalAcceptedForCurrentRound atomic.Value // *specqbft.SignedMessage }
State holds an iBFT state, thread safe
func (*State) GetIdentifier ¶
GetIdentifier returns the identifier of the state
func (*State) GetInputValue ¶
GetInputValue returns the input value of the state
func (*State) GetPreparedRound ¶
GetPreparedRound returns the prepared round of the state
func (*State) GetPreparedValue ¶
GetPreparedValue returns the prepared value of the state
func (*State) GetProposalAcceptedForCurrentRound ¶ added in v0.3.2
func (s *State) GetProposalAcceptedForCurrentRound() *specqbft.SignedMessage
GetProposalAcceptedForCurrentRound returns proposal accepted for current round
func (*State) MarshalJSON ¶
MarshalJSON implements marshaling interface
func (*State) UnmarshalJSON ¶
UnmarshalJSON implements marshaling interface