Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetValidatorOutput ¶
GetValidatorOutput is the output of GetValidator
type Set ¶
type Set interface {
// Add adds a validator
Add(nodeID ids.NodeID, pk *bls.PublicKey, txID ids.ID, weight uint64) error
// AddWeight adds weight to a validator
AddWeight(nodeID ids.NodeID, weight uint64) error
// Get returns a validator's weight
Get(nodeID ids.NodeID) (uint64, bool)
// GetWeight returns a validator's weight
GetWeight(nodeID ids.NodeID) uint64
// SubsetWeight returns the total weight of a subset
SubsetWeight(subset []ids.NodeID) uint64
// Remove removes a validator
Remove(nodeID ids.NodeID) error
// RemoveWeight removes weight from a validator
RemoveWeight(nodeID ids.NodeID, weight uint64) error
// Contains returns true if the validator is in the set
Contains(nodeID ids.NodeID) bool
// Len returns the number of validators
Len() int
// List returns all validator IDs
List() []ids.NodeID
// Weight returns the total weight
Weight() uint64
// Sample returns a sample of validators
Sample(size int) ([]ids.NodeID, error)
// String returns a string representation
String() string
}
Set manages a set of validators
type State ¶
type State interface {
// GetValidatorSet returns the validator set for a subnet at a given height
GetValidatorSet(
ctx interface{},
height uint64,
subnetID ids.ID,
) (map[ids.NodeID]*GetValidatorOutput, error)
// GetValidator returns a validator's info
GetValidator(
ctx interface{},
subnetID ids.ID,
nodeID ids.NodeID,
) (*GetValidatorOutput, error)
}
State manages the validator set state
Click to show internal directories.
Click to hide internal directories.