Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Voter ¶
type Voter struct {
// contains filtered or unexported fields
}
Voter produces votes for the given block
func New ¶
func New( signer hotstuff.Signer, forks hotstuff.ForksReader, persist hotstuff.Persister, committee hotstuff.Committee, lastVotedView uint64, ) *Voter
New creates a new Voter instance
func (*Voter) ProduceVoteIfVotable ¶
ProduceVoteIfVotable will make a decision on whether it will vote for the given proposal, the returned error indicates whether to vote or not. In order to ensure that only a safe node will be voted, Voter will ask Forks whether a vote is a safe node or not. The curView is taken as input to ensure Voter will only vote for proposals at current view and prevent double voting. Returns:
- (vote, nil): On the _first_ block for the current view that is safe to vote for. Subsequently, voter does _not_ vote for any other block with the same (or lower) view.
- (nil, model.NoVoteError): If the voter decides that it does not want to vote for the given block. This is a sentinel error and _expected_ during normal operation.
All other errors are unexpected and potential symptoms of uncovered edge cases or corrupted internal state (fatal).
Click to show internal directories.
Click to hide internal directories.