Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Commit

Permalink
add Size() method to peer.ID.
Browse files Browse the repository at this point in the history
  • Loading branch information
raulk committed Dec 12, 2018
1 parent 940fa8a commit 48add7b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions peer_serde.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down

0 comments on commit 48add7b

Please sign in to comment.