gecko/snow/consensus/avalanche/ids_test.go

41 lines
644 B
Go

// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package avalanche
import (
"github.com/ava-labs/gecko/ids"
)
func GenerateID() ids.ID {
offset++
return ids.Empty.Prefix(offset)
}
func Matches(a, b []ids.ID) bool {
if len(a) != len(b) {
return false
}
set := ids.Set{}
set.Add(a...)
for _, id := range b {
if !set.Contains(id) {
return false
}
}
return true
}
func MatchesShort(a, b []ids.ShortID) bool {
if len(a) != len(b) {
return false
}
set := ids.ShortSet{}
set.Add(a...)
for _, id := range b {
if !set.Contains(id) {
return false
}
}
return true
}