Commit 473d0256 authored by acud's avatar acud Committed by GitHub

swarm: change MaxPO to 32 (#1593)

parent 25402864
......@@ -1069,6 +1069,22 @@ func (k *Kad) Snapshot() *topology.KadParams {
Bin13: infos[13],
Bin14: infos[14],
Bin15: infos[15],
Bin16: infos[16],
Bin17: infos[17],
Bin18: infos[18],
Bin19: infos[19],
Bin20: infos[20],
Bin21: infos[21],
Bin22: infos[22],
Bin23: infos[23],
Bin24: infos[24],
Bin25: infos[25],
Bin26: infos[26],
Bin27: infos[27],
Bin28: infos[28],
Bin29: infos[29],
Bin30: infos[30],
Bin31: infos[31],
},
}
}
......
......@@ -156,16 +156,16 @@ func TestNeighborhoodDepth(t *testing.T) {
// add a whole bunch of peers in bin 15, expect depth to stay at 15
for i := 0; i < 15; i++ {
addr = test.RandomAddressAt(base, 15)
addr = test.RandomAddressAt(base, int(swarm.MaxPO))
addOne(t, signer, kad, ab, addr)
}
waitCounter(t, &conns, 15)
kDepth(t, kad, 15)
kDepth(t, kad, 31)
// remove one at 14, depth should be 14
removeOne(kad, addrs[len(addrs)-5])
kDepth(t, kad, 14)
kDepth(t, kad, 30)
// empty bin 9 and expect depth 9
for i := 0; i < 4; i++ {
......
......@@ -120,8 +120,8 @@ LOOP:
// Cursors gets the last BinID for every bin in the local storage
func (s *ps) Cursors(ctx context.Context) (curs []uint64, err error) {
curs = make([]uint64, 16)
for i := uint8(0); i < 16; i++ {
curs = make([]uint64, swarm.MaxBins)
for i := uint8(0); i < swarm.MaxBins; i++ {
binID, err := s.Storer.LastPullSubscriptionBinID(i)
if err != nil {
return nil, err
......
......@@ -23,7 +23,7 @@ const (
BmtBranches = 128
ChunkSize = SectionSize * Branches
HashSize = 32
MaxPO uint8 = 15
MaxPO uint8 = 31
ExtendedPO uint8 = MaxPO + 5
MaxBins = MaxPO + 1
ChunkWithSpanSize = ChunkSize + SpanSize
......
......@@ -88,6 +88,22 @@ type KadBins struct {
Bin13 BinInfo `json:"bin_13"`
Bin14 BinInfo `json:"bin_14"`
Bin15 BinInfo `json:"bin_15"`
Bin16 BinInfo `json:"bin_16"`
Bin17 BinInfo `json:"bin_17"`
Bin18 BinInfo `json:"bin_18"`
Bin19 BinInfo `json:"bin_19"`
Bin20 BinInfo `json:"bin_20"`
Bin21 BinInfo `json:"bin_21"`
Bin22 BinInfo `json:"bin_22"`
Bin23 BinInfo `json:"bin_23"`
Bin24 BinInfo `json:"bin_24"`
Bin25 BinInfo `json:"bin_25"`
Bin26 BinInfo `json:"bin_26"`
Bin27 BinInfo `json:"bin_27"`
Bin28 BinInfo `json:"bin_28"`
Bin29 BinInfo `json:"bin_29"`
Bin30 BinInfo `json:"bin_30"`
Bin31 BinInfo `json:"bin_31"`
}
type KadParams struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment