mirror of
https://github.com/status-im/go-waku.git
synced 2025-01-12 23:04:45 +00:00
fix: remove max number of shards verif (#1081)
This commit is contained in:
parent
e29cf0d191
commit
3f69fb3776
@ -4,7 +4,6 @@ import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"strings"
|
||||
|
||||
"github.com/waku-org/go-waku/waku/v2/hash"
|
||||
@ -20,7 +19,6 @@ const ClusterIndex = 1
|
||||
const GenerationZeroShardsCount = 8
|
||||
|
||||
var (
|
||||
ErrTooManyShards = errors.New("too many shards")
|
||||
ErrInvalidShard = errors.New("invalid shard")
|
||||
ErrInvalidShardCount = errors.New("invalid shard count")
|
||||
ErrExpected130Bytes = errors.New("invalid data: expected 130 bytes")
|
||||
@ -32,10 +30,6 @@ type RelayShards struct {
|
||||
}
|
||||
|
||||
func NewRelayShards(clusterID uint16, shardIDs ...uint16) (RelayShards, error) {
|
||||
if len(shardIDs) > math.MaxUint8 {
|
||||
return RelayShards{}, ErrTooManyShards
|
||||
}
|
||||
|
||||
shardIDSet := make(map[uint16]struct{})
|
||||
for _, index := range shardIDs {
|
||||
if index > MaxShardIndex {
|
||||
@ -142,10 +136,6 @@ func (rs RelayShards) ContainsTopic(topic string) bool {
|
||||
}
|
||||
|
||||
func (rs RelayShards) ShardList() ([]byte, error) {
|
||||
if len(rs.ShardIDs) > math.MaxUint8 {
|
||||
return nil, ErrTooManyShards
|
||||
}
|
||||
|
||||
var result []byte
|
||||
|
||||
result = binary.BigEndian.AppendUint16(result, rs.ClusterID)
|
||||
|
Loading…
x
Reference in New Issue
Block a user