github.com/koko1123/flow-go-1@v0.29.6/consensus/hotstuff/model/vote.go (about)

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