aa98592ac4
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
27 lines
543 B
Go
27 lines
543 B
Go
package wrapper
|
|
|
|
import (
|
|
"github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
// 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.StableMarshal(nil)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
args := netmap.AddPeerArgs{}
|
|
args.SetInfo(rawNodeInfo)
|
|
|
|
return errors.Wrap(
|
|
w.client.AddPeer(args),
|
|
"could not invoke smart contract",
|
|
)
|
|
}
|