[#1008] ir/netmap: Call Register method on peer approval

After https://github.com/nspcc-dev/neofs-contract/issues/154 alphabet
nodes should call `Register` method for approval of the notary
notifications spawned by `AddPeer` method.

Call `register` method for peer approval in Netmap processor.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-12-07 17:04:32 +03:00 committed by Alex Vanin
parent 89eca449b6
commit 3d5eb2a396

View file

@ -88,6 +88,11 @@ func (np *Processor) processAddPeer(ev netmapEvent.AddPeer) {
prm := netmapclient.AddPeerPrm{}
prm.SetNodeInfo(nodeInfo)
// In notary environments we call Register method instead of AddPeer.
// It differs from AddPeer only by name, so we can do this in the same form.
// See https://github.com/nspcc-dev/neofs-contract/issues/154.
const methodAddPeerNotary = "register"
if nr := ev.NotaryRequest(); nr != nil {
// create new notary request with the original nonce
err = np.netmapClient.Morph().NotaryInvoke(
@ -95,7 +100,7 @@ func (np *Processor) processAddPeer(ev netmapEvent.AddPeer) {
0,
nr.MainTransaction.Nonce,
nil,
netmapEvent.AddPeerNotaryEvent,
methodAddPeerNotary,
nodeInfoBinary,
)
} else {