From 9528fe6bd1d984f6f017ff373e510051cb141361 Mon Sep 17 00:00:00 2001 From: tau3 Date: Fri, 28 Feb 2020 15:20:57 +0400 Subject: [PATCH] fixes after code review --- p2p/pex/addrbook.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/p2p/pex/addrbook.go b/p2p/pex/addrbook.go index 5b67e4967..4605ad260 100644 --- a/p2p/pex/addrbook.go +++ b/p2p/pex/addrbook.go @@ -103,8 +103,7 @@ type addrBook struct { } func newHashKey() []byte { - highwayKeyLength := highwayhash.Size - result := make([]byte, highwayKeyLength) + result := make([]byte, highwayhash.Size) crand.Read(result) return result } @@ -777,7 +776,7 @@ func (a *addrBook) calcNewBucket(addr, src *p2p.NetAddress) (int, error) { } // hash( key + group + -// hash(doublesha256(key + addr))%buckets_per_group ) % num_old_buckets +// int64(hash(key + addr))%buckets_per_group ) % num_old_buckets func (a *addrBook) calcOldBucket(addr *p2p.NetAddress) (int, error) { data1 := []byte{} data1 = append(data1, []byte(a.key)...)