github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/consensus/hotstuff/model/vote.go (about) 1 package model 2 3 import ( 4 "github.com/onflow/crypto" 5 6 "github.com/onflow/flow-go/model/flow" 7 ) 8 9 // Vote is the HotStuff algorithm's concept of a vote for a block proposal. 10 type Vote struct { 11 View uint64 12 BlockID flow.Identifier 13 SignerID flow.Identifier 14 SigData []byte 15 } 16 17 // ID returns the identifier for the vote. 18 func (uv *Vote) ID() flow.Identifier { 19 return flow.MakeID(uv) 20 } 21 22 // VoteFromFlow turns the vote parameters into a vote struct. 23 func VoteFromFlow(signerID flow.Identifier, blockID flow.Identifier, view uint64, sig crypto.Signature) *Vote { 24 vote := Vote{ 25 View: view, 26 BlockID: blockID, 27 SignerID: signerID, 28 SigData: sig, 29 } 30 return &vote 31 }