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.SignerVerifier, forks hotstuff.ForksReader, persist hotstuff.Persister, 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. This method will only ever _once_ return a `non-nil vote, nil` vote: the very first time it encounters a safe block of the
current view to vote for. Subsequently, voter does _not_ vote for any other block with the same (or lower) view.
(including repeated calls with the initial block we voted for also return `nil, error`).