Documentation ¶
Index ¶
- type Bid
- type BidList
- type Keys
- type Member
- type Provisioners
- func (p *Provisioners) AddMember(pubKeyEd, pubKeyBLS []byte, amount, startHeight, endHeight uint64) error
- func (p *Provisioners) CreateVotingCommittee(round, totalWeight uint64, step uint8, size int) *VotingCommittee
- func (p *Provisioners) GetMember(pubKeyBLS []byte) *Member
- func (p *Provisioners) GetStake(pubKeyBLS []byte) (uint64, error)
- func (p *Provisioners) MemberAt(i int) *Member
- func (p *Provisioners) Remove(pubKeyBLS []byte) bool
- func (p *Provisioners) RemoveExpired(round uint64) uint64
- func (p *Provisioners) Size(round uint64) int
- type VotingCommittee
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bid ¶
Bid is the 32 byte X value, created from a bidding transaction amount and M.
func CalculateX ¶
type BidList ¶
type BidList []Bid
BidList is a list of bid X values.
func ReconstructBidListSubset ¶
ReconstructBidListSubset will turn a slice of bytes into a BidList.
func (*BidList) RemoveExpired ¶
RemoveExpired iterates over a BidList to remove expired bids.
type Keys ¶
type Keys struct { BLSPubKey *bls.PublicKey BLSPubKeyBytes []byte BLSSecretKey *bls.SecretKey EdPubKey *ed25519.PublicKey EdPubKeyBytes []byte EdSecretKey *ed25519.PrivateKey }
Keys are the keys used during consensus
func NewKeysFromBytes ¶
func NewRandKeys ¶
NewRandKeys will generate and return new bls and ed25519 keys to be used in consensus
type Member ¶
Member contains the bytes of a provisioner's Ed25519 public key, the bytes of his BLS public key, and how much he has staked.
type Provisioners ¶
type Provisioners struct {
// contains filtered or unexported fields
}
Provisioners is a slice of Members, and makes up the current provisioner committee. It implements sort.Interface
func NewProvisioners ¶
func NewProvisioners(db database.DB) (*Provisioners, uint64, error)
NewProvisioners returns an initialized Provisioners struct.
func (*Provisioners) AddMember ¶
func (p *Provisioners) AddMember(pubKeyEd, pubKeyBLS []byte, amount, startHeight, endHeight uint64) error
AddMember will add a Member to the Provisioners by using the bytes of a BLS public key.
func (*Provisioners) CreateVotingCommittee ¶
func (p *Provisioners) CreateVotingCommittee(round, totalWeight uint64, step uint8, size int) *VotingCommittee
CreateVotingCommittee will run the deterministic sortition function, which determines who will be in the committee for a given step and round.
func (*Provisioners) GetMember ¶
func (p *Provisioners) GetMember(pubKeyBLS []byte) *Member
GetMember returns a member of the provisioners from its BLS public key.
func (*Provisioners) GetStake ¶
func (p *Provisioners) GetStake(pubKeyBLS []byte) (uint64, error)
GetStake will find a certain provisioner in the committee by BLS public key, and return their stake.
func (*Provisioners) MemberAt ¶
func (p *Provisioners) MemberAt(i int) *Member
MemberAt returns the Member at a certain index.
func (*Provisioners) Remove ¶
func (p *Provisioners) Remove(pubKeyBLS []byte) bool
Remove a Member, designated by their BLS public key.
func (*Provisioners) RemoveExpired ¶
func (p *Provisioners) RemoveExpired(round uint64) uint64
func (*Provisioners) Size ¶
func (p *Provisioners) Size(round uint64) int
Size returns the amount of Members contained within a Provisioners struct.
type VotingCommittee ¶
VotingCommittee represents a set of provisioners with voting rights at a certain point in the consensus. The set is sorted by the int value of the public key in increasing order (higher last)
func (*VotingCommittee) Equal ¶
func (v *VotingCommittee) Equal(other *VotingCommittee) bool
Equal checks if two VotingCommittees are the same.
func (*VotingCommittee) IsMember ¶
func (v *VotingCommittee) IsMember(pubKeyBLS []byte) bool
IsMember checks if `pubKeyBLS` is within the VotingCommittee.
func (*VotingCommittee) MemberKeys ¶
func (v *VotingCommittee) MemberKeys() [][]byte
MemberKeys returns the BLS public keys of all the members in a VotingCommittee.
func (*VotingCommittee) Remove ¶
func (v *VotingCommittee) Remove(pk []byte) bool
Remove a member from the VotingCommittee by its BLS public key.
func (*VotingCommittee) Size ¶
func (v *VotingCommittee) Size() int
Size returns how many members there are in a VotingCommittee.