[#265] pkg/reputation: Change PeerID implementation

Make `PeerID` type to be the wrapper over v2 `PeerID` message structure.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-04-02 12:20:09 +03:00 committed by Leonard Lyubich
parent c5000a3334
commit 05a351d344
3 changed files with 123 additions and 21 deletions

View file

@ -8,7 +8,11 @@ import (
func GeneratePeerID() *reputation.PeerID {
v := reputation.NewPeerID()
v.SetBytes(crypto.MarshalPublicKey(&test.DecodeKey(-1).PublicKey))
key := [crypto.PublicKeyCompressedSize]byte{}
copy(key[:], crypto.MarshalPublicKey(&test.DecodeKey(-1).PublicKey))
v.SetPublicKey(key)
return v
}