[#15] Use api-go definition of NodeInfo in node

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-09-08 12:37:53 +03:00
parent f0ee275ce6
commit ee9551992c
4 changed files with 20 additions and 120 deletions

View file

@ -25,13 +25,16 @@ func bootstrapNode(c *cfg) {
cli, err := netmap.New(staticClient)
fatalOnErr(err)
peerInfo := new(netmap.PeerInfo)
peerInfo := new(netmap.NodeInfo)
peerInfo.SetAddress(c.cfgNodeInfo.address)
peerInfo.SetPublicKey(crypto.MarshalPublicKey(&c.key.PublicKey))
// todo: add attributes as opts
rawInfo, err := peerInfo.StableMarshal(nil)
fatalOnErr(err)
args := new(netmap.AddPeerArgs)
args.SetInfo(*peerInfo)
args.SetInfo(rawInfo)
err = cli.AddPeer(*args)
fatalOnErr(err)
}