frostfs-node/pkg/services/reputation/peer.go
Leonard Lyubich eadb3204f0 [] reputation: Define basic types
Define PeerID, TrustValue and Trust types and basic methods on them.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-03-24 10:11:52 +03:00

17 lines
355 B
Go

package reputation
const peerIDLength = 33
// PeerID represents identifier of reputation system participant.
type PeerID [peerIDLength]byte
// Bytes converts PeerID to []byte.
func (id PeerID) Bytes() []byte {
return id[:]
}
// PeerIDFromBytes restores PeerID from []byte.
func PeerIDFromBytes(data []byte) (id PeerID) {
copy(id[:], data)
return
}