@@ -831,7 +831,7 @@ func (a *addrBook) addBadPeer(addr *p2p.NetAddress, banTime time.Duration) bool
831831
832832// hash(key + sourcegroup + int64(hash(key + group + sourcegroup)) % bucket_per_group) % num_new_buckets
833833func (a * addrBook ) calcNewBucket (addr , src * p2p.NetAddress ) (int , error ) {
834- data1 := []byte {}
834+ data1 := []byte {} //nolint:prealloc
835835 data1 = append (data1 , []byte (a .key )... )
836836 data1 = append (data1 , []byte (a .groupKey (addr ))... )
837837 data1 = append (data1 , []byte (a .groupKey (src ))... )
@@ -843,7 +843,7 @@ func (a *addrBook) calcNewBucket(addr, src *p2p.NetAddress) (int, error) {
843843 hash64 %= newBucketsPerGroup
844844 var hashbuf [8 ]byte
845845 binary .BigEndian .PutUint64 (hashbuf [:], hash64 )
846- data2 := []byte {}
846+ data2 := []byte {} //nolint:prealloc
847847 data2 = append (data2 , []byte (a .key )... )
848848 data2 = append (data2 , a .groupKey (src )... )
849849 data2 = append (data2 , hashbuf [:]... )
@@ -858,7 +858,7 @@ func (a *addrBook) calcNewBucket(addr, src *p2p.NetAddress) (int, error) {
858858
859859// hash(key + group + int64(hash(key + addr)) % buckets_per_group) % num_old_buckets
860860func (a * addrBook ) calcOldBucket (addr * p2p.NetAddress ) (int , error ) {
861- data1 := []byte {}
861+ data1 := []byte {} //nolint:prealloc
862862 data1 = append (data1 , []byte (a .key )... )
863863 data1 = append (data1 , []byte (addr .String ())... )
864864 hash1 , err := a .hash (data1 )
@@ -869,7 +869,7 @@ func (a *addrBook) calcOldBucket(addr *p2p.NetAddress) (int, error) {
869869 hash64 %= oldBucketsPerGroup
870870 var hashbuf [8 ]byte
871871 binary .BigEndian .PutUint64 (hashbuf [:], hash64 )
872- data2 := []byte {}
872+ data2 := []byte {} //nolint:prealloc
873873 data2 = append (data2 , []byte (a .key )... )
874874 data2 = append (data2 , a .groupKey (addr )... )
875875 data2 = append (data2 , hashbuf [:]... )
0 commit comments