Documentation ¶
Index ¶
- Constants
- Variables
- type HeightVoteSet
- func (hvs *HeightVoteSet) AddVote(vote *types.Vote, peerID p2p.ID) (bool, error)
- func (hvs *HeightVoteSet) Height() int64
- func (hvs *HeightVoteSet) MarshalJSON() ([]byte, error)
- func (hvs *HeightVoteSet) POLInfo() (polRound int32, polBlockID types.BlockID)
- func (hvs *HeightVoteSet) Precommits(round int32) *types.VoteSet
- func (hvs *HeightVoteSet) Prevotes(round int32) *types.VoteSet
- func (hvs *HeightVoteSet) Reset(height int64, valSet *types.ValidatorSet)
- func (hvs *HeightVoteSet) Round() int32
- func (hvs *HeightVoteSet) SetPeerMaj23(round int32, voteType bcproto.SignedMsgType, peerID p2p.ID, ...) error
- func (hvs *HeightVoteSet) SetRound(round int32)
- type PeerRoundState
- type RoundState
- func (rs *RoundState) CompleteProposalEvent() types.EventDataCompleteProposal
- func (rs *RoundState) IsValid() bool
- func (rs *RoundState) NewRoundEvent() types.EventDataNewRound
- func (rs *RoundState) RoundStateEvent() types.EventDataRoundState
- func (rs *RoundState) String() string
- func (rs *RoundState) StringShort() string
- func (rs *RoundState) ToSimple() (RoundStateSimple, error)
- type RoundStateSimple
- type RoundStepType
- type RoundVoteSet
Constants ¶
View Source
const ( RoundStepNewHeight = RoundStepType(1) RoundStepNewRound = RoundStepType(2) RoundStepPropose = RoundStepType(3) RoundStepPrevote = RoundStepType(4) RoundStepPrevoteWait = RoundStepType(5) RoundStepPrecommit = RoundStepType(6) RoundStepPrecommitWait = RoundStepType(7) RoundStepCommit = RoundStepType(8) )
Variables ¶
View Source
var ErrUnwantedRoundVote = errors.New("peer sent vote from unwanted round")
Functions ¶
This section is empty.
Types ¶
type HeightVoteSet ¶
type HeightVoteSet struct {
// contains filtered or unexported fields
}
func NewHeightVoteSet ¶
func NewHeightVoteSet(chainID string, height int64, valSet *types.ValidatorSet) *HeightVoteSet
func (*HeightVoteSet) Height ¶
func (hvs *HeightVoteSet) Height() int64
func (*HeightVoteSet) MarshalJSON ¶
func (hvs *HeightVoteSet) MarshalJSON() ([]byte, error)
func (*HeightVoteSet) POLInfo ¶
func (hvs *HeightVoteSet) POLInfo() (polRound int32, polBlockID types.BlockID)
func (*HeightVoteSet) Precommits ¶
func (hvs *HeightVoteSet) Precommits(round int32) *types.VoteSet
func (*HeightVoteSet) Reset ¶
func (hvs *HeightVoteSet) Reset(height int64, valSet *types.ValidatorSet)
func (*HeightVoteSet) Round ¶
func (hvs *HeightVoteSet) Round() int32
func (*HeightVoteSet) SetPeerMaj23 ¶
func (hvs *HeightVoteSet) SetPeerMaj23(round int32, voteType bcproto.SignedMsgType, peerID p2p.ID, blockID types.BlockID) error
func (*HeightVoteSet) SetRound ¶
func (hvs *HeightVoteSet) SetRound(round int32)
type PeerRoundState ¶
type PeerRoundState struct { Height int64 `json:"height"` Round int32 `json:"round"` Step RoundStepType `json:"step"` StartTime time.Time `json:"start_time"` // Proposal state Proposal bool `json:"proposal"` ProposalBlockPartSetHeader types.PartSetHeader `json:"proposal_block_part_set_header"` ProposalBlockParts *bits.BitArray `json:"proposal_block_parts"` ProposalPOLRound int32 `json:"proposal_pol_round"` ProposalPOL *bits.BitArray `json:"proposal_pol"` // Voting state Prevotes *bits.BitArray `json:"prevotes"` Precommits *bits.BitArray `json:"precommits"` // Commit state LastCommitRound int32 `json:"last_commit_round"` LastCommit *bits.BitArray `json:"last_commit"` CatchupCommitRound int32 `json:"catchup_commit_round"` CatchupCommit *bits.BitArray `json:"catchup_commit"` }
PeerRoundState represents a peer's known state in the consensus protocol
func NewPeerRoundState ¶
func NewPeerRoundState(height int64, round int32) *PeerRoundState
NewPeerRoundState creates a new PeerRoundState instance
func (PeerRoundState) HasPrecommitQuorum ¶
func (prs PeerRoundState) HasPrecommitQuorum() bool
HasPrecommitQuorum checks if the peer has +2/3 precommits
func (PeerRoundState) HasPrevoteQuorum ¶
func (prs PeerRoundState) HasPrevoteQuorum() bool
HasPrevoteQuorum checks if the peer has +2/3 prevotes
func (PeerRoundState) HasProposal ¶
func (prs PeerRoundState) HasProposal() bool
HasProposal checks if the peer has a complete proposal
func (PeerRoundState) IsValid ¶
func (prs PeerRoundState) IsValid() bool
IsValid performs basic validation of the peer round state
func (PeerRoundState) String ¶
func (prs PeerRoundState) String() string
String returns a string representation of PeerRoundState
func (PeerRoundState) StringIndented ¶
func (prs PeerRoundState) StringIndented(indent string) string
StringIndented returns an indented string representation of PeerRoundState
type RoundState ¶
type RoundState struct { Height int64 `json:"height"` Round int32 `json:"round"` Step RoundStepType `json:"step"` StartTime time.Time `json:"start_time"` CommitTime time.Time `json:"commit_time"` Validators *types.ValidatorSet `json:"validators"` Proposal *types.Proposal `json:"proposal"` ProposalBlock *types.Block `json:"proposal_block"` ProposalBlockParts *types.PartSet `json:"proposal_block_parts"` LockedRound int32 `json:"locked_round"` LockedBlock *types.Block `json:"locked_block"` LockedBlockParts *types.PartSet `json:"locked_block_parts"` ValidRound int32 `json:"valid_round"` ValidBlock *types.Block `json:"valid_block"` ValidBlockParts *types.PartSet `json:"valid_block_parts"` Votes *HeightVoteSet `json:"votes"` CommitRound int32 `json:"commit_round"` LastCommit *types.VoteSet `json:"last_commit"` LastValidators *types.ValidatorSet `json:"last_validators"` TriggeredTimeoutPrecommit bool `json:"triggered_timeout_precommit"` }
func NewRoundState ¶
func NewRoundState(height int64, validators *types.ValidatorSet) *RoundState
func (*RoundState) CompleteProposalEvent ¶
func (rs *RoundState) CompleteProposalEvent() types.EventDataCompleteProposal
func (*RoundState) IsValid ¶
func (rs *RoundState) IsValid() bool
func (*RoundState) NewRoundEvent ¶
func (rs *RoundState) NewRoundEvent() types.EventDataNewRound
func (*RoundState) RoundStateEvent ¶
func (rs *RoundState) RoundStateEvent() types.EventDataRoundState
func (*RoundState) String ¶
func (rs *RoundState) String() string
func (*RoundState) StringShort ¶
func (rs *RoundState) StringShort() string
func (*RoundState) ToSimple ¶
func (rs *RoundState) ToSimple() (RoundStateSimple, error)
type RoundStateSimple ¶
type RoundStateSimple struct { HeightRoundStep string `json:"height/round/step"` StartTime time.Time `json:"start_time"` ProposalBlockHash bytes.HexBytes `json:"proposal_block_hash"` LockedBlockHash bytes.HexBytes `json:"locked_block_hash"` ValidBlockHash bytes.HexBytes `json:"valid_block_hash"` Votes json.RawMessage `json:"height_vote_set"` Proposer types.ValidatorInfo `json:"proposer"` }
type RoundStepType ¶
type RoundStepType uint8
func (RoundStepType) IsValid ¶
func (rs RoundStepType) IsValid() bool
func (RoundStepType) String ¶
func (rs RoundStepType) String() string
Click to show internal directories.
Click to hide internal directories.