Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions vms/platformvm/warp/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,17 @@ func GetCanonicalValidatorSet(
return nil, 0, err
}

// Convert the validator set into the canonical ordering.
return FlattenValidatorSet(vdrSet)
}

// FlattenValidatorSet converts the provided [vdrSet] into a canonical ordering.
// Also returns the total weight of the validator set.
func FlattenValidatorSet(vdrSet map[ids.NodeID]*validators.GetValidatorOutput) ([]*Validator, uint64, error) {
var (
vdrs = make(map[string]*Validator, len(vdrSet))
totalWeight uint64
err error
)
for _, vdr := range vdrSet {
totalWeight, err = math.Add64(totalWeight, vdr.Weight)
Expand Down