From 48add7b3fd07eab3b7a097d47937a0133b2ce5cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Wed, 12 Dec 2018 13:20:11 +0000 Subject: [PATCH] add Size() method to peer.ID. --- peer_serde.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/peer_serde.go b/peer_serde.go index 3339f8b..8db24f7 100644 --- a/peer_serde.go +++ b/peer_serde.go @@ -25,6 +25,10 @@ func (id *ID) Unmarshal(data []byte) (err error) { return err } +func (id ID) Size() int { + return len([]byte(id)) +} + func (id ID) MarshalJSON() ([]byte, error) { return json.Marshal(IDB58Encode(id)) }