[#149] sdk/netmap: Add net address getter to Node

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-09-17 13:11:40 +03:00 committed by Stanislav Bogatyrev
parent f8e7a577de
commit 7ef249f8db
2 changed files with 27 additions and 0 deletions

View file

@ -38,6 +38,12 @@ func (n Node) Hash() uint64 {
return n.ID
}
// NetworkAddress returns network address
// of the node in a string format.
func (n Node) NetworkAddress() string {
return n.InfoV2.GetAddress()
}
// NodesFromV2 converts slice of v2 netmap.NodeInfo to a generic node slice.
func NodesFromV2(infos []netmap.NodeInfo) Nodes {
nodes := make(Nodes, len(infos))