frostfs-node/pkg/morph/client/netmap/wrapper/add_peer.go

28 lines
534 B
Go
Raw Normal View History

2020-07-24 13:54:03 +00:00
package wrapper
import (
"github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap"
"github.com/pkg/errors"
)
2020-07-24 13:54:03 +00:00
// AddPeer registers peer in NeoFS network through
// Netmap contract call.
func (w *Wrapper) AddPeer(nodeInfo *netmap.NodeInfo) error {
if nodeInfo == nil {
return errors.New("nil node info")
}
rawNodeInfo, err := nodeInfo.Marshal()
if err != nil {
return err
}
args := netmap.AddPeerArgs{}
args.SetInfo(rawNodeInfo)
return errors.Wrap(
w.client.AddPeer(args),
"could not invoke smart contract",
)
2020-07-24 13:54:03 +00:00
}