diff --git a/pot/address.go b/pot/address.go index 350f15819a..039f8421f4 100644 --- a/pot/address.go +++ b/pot/address.go @@ -105,13 +105,13 @@ func posProximity(one, other Address, pos int) (ret int, eq bool) { if one[i] == other[i] { continue } - oxo := one[i] ^ other[i] + oxo := uint8(one[i] ^ other[i]) start := 0 if i == pos/8 { start = pos % 8 } for j := start; j < 8; j++ { - if (uint8(oxo)>>uint8(7-j))&0x01 != 0 { + if (oxo>>uint8(7-j))&0x01 != 0 { return i*8 + j, false } } @@ -173,13 +173,13 @@ func RandomAddress() Address { func NewAddressFromString(s string) []byte { ha := [32]byte{} - t := s + string(zerosBin)[:len(zerosBin)-len(s)] + t := s + zerosBin[:len(zerosBin)-len(s)] for i := 0; i < 4; i++ { n, err := strconv.ParseUint(t[i*64:(i+1)*64], 2, 64) if err != nil { panic("wrong format: " + err.Error()) } - binary.BigEndian.PutUint64(ha[i*8:(i+1)*8], uint64(n)) + binary.BigEndian.PutUint64(ha[i*8:(i+1)*8], n) } return ha[:] } @@ -229,7 +229,7 @@ func proximityOrder(one, other []byte, pos int) (int, bool) { start = pos % 8 } for j := start; j < 8; j++ { - if (uint8(oxo)>>uint8(7-j))&0x01 != 0 { + if (oxo>>uint8(7-j))&0x01 != 0 { return i*8 + j, false } } diff --git a/swarm/pss/api.go b/swarm/pss/api.go index 997800624b..6505d33023 100644 --- a/swarm/pss/api.go +++ b/swarm/pss/api.go @@ -96,7 +96,7 @@ func (pssapi *API) BaseAddr() (PssAddress, error) { func (pssapi *API) GetPublicKey() (keybytes hexutil.Bytes) { key := pssapi.Pss.PublicKey() keybytes = crypto.FromECDSAPub(key) - return hexutil.Bytes(keybytes) + return keybytes } // Set Public key to associate with a particular Pss peer diff --git a/swarm/pss/handshake.go b/swarm/pss/handshake.go index 80aa729111..17e7004798 100644 --- a/swarm/pss/handshake.go +++ b/swarm/pss/handshake.go @@ -444,7 +444,7 @@ func (self *HandshakeAPI) Handshake(pubkeyid string, topic Topic, sync bool, flu keycount = self.ctrl.symKeyCapacity } else { validkeys := self.ctrl.validKeys(pubkeyid, &topic, false) - keycount = uint8(self.ctrl.symKeyCapacity - uint8(len(validkeys))) + keycount = self.ctrl.symKeyCapacity - uint8(len(validkeys)) } if keycount == 0 { return keys, errors.New("Incoming symmetric key store is already full")