From 3d5eb2a396c2b772eebe4d4f8e0c9885ba4411c2 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 7 Dec 2021 17:04:32 +0300 Subject: [PATCH] [#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 --- pkg/innerring/processors/netmap/process_peers.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/innerring/processors/netmap/process_peers.go b/pkg/innerring/processors/netmap/process_peers.go index 55ba9c80f..4294de474 100644 --- a/pkg/innerring/processors/netmap/process_peers.go +++ b/pkg/innerring/processors/netmap/process_peers.go @@ -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 {