From a4f9d52cfc6fdcbba4e4ec3c42729ef0b4a9650d Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 11 Mar 2022 12:19:35 +0300 Subject: [PATCH] [#225] netmap: Rename `Register` to `AddPeerIR` Similar to `UpdateState`/`UpdateStateIR` pair. Signed-off-by: Evgenii Stratonikov --- netmap/netmap_contract.go | 8 ++++---- tests/container_test.go | 2 +- tests/netmap_test.go | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/netmap/netmap_contract.go b/netmap/netmap_contract.go index 621dbc9..6dec3b8 100644 --- a/netmap/netmap_contract.go +++ b/netmap/netmap_contract.go @@ -190,13 +190,13 @@ func UpdateInnerRing(keys []interop.PublicKey) { common.SetSerialized(ctx, innerRingKey, irList) } -// Register method tries to add new candidate to the network map. -// Should be invoked in notary-enabled environment by the alphabet. -func Register(nodeInfo []byte) { +// AddPeerIR method tries to add new candidate to the network map. +// Should only be invoked in notary-enabled environment by the alphabet. +func AddPeerIR(nodeInfo []byte) { ctx := storage.GetContext() notaryDisabled := storage.Get(ctx, notaryDisabledKey).(bool) if notaryDisabled { - panic("Register should only be called in notary-enabled environment") + panic("AddPeerIR should only be called in notary-enabled environment") } common.CheckAlphabetWitness(common.AlphabetAddress()) diff --git a/tests/container_test.go b/tests/container_test.go index 520a725..32a8a4f 100644 --- a/tests/container_test.go +++ b/tests/container_test.go @@ -267,7 +267,7 @@ func TestContainerSizeEstimation(t *testing.T) { } for i := range nodes { cNm.WithSigners(nodes[i].signer).Invoke(t, stackitem.Null{}, "addPeer", nodes[i].raw) - cNm.Invoke(t, stackitem.Null{}, "register", nodes[i].raw) + cNm.Invoke(t, stackitem.Null{}, "addPeerIR", nodes[i].raw) } // putContainerSize retrieves storage nodes from the previous snapshot, diff --git a/tests/netmap_test.go b/tests/netmap_test.go index 797163f..1360257 100644 --- a/tests/netmap_test.go +++ b/tests/netmap_test.go @@ -107,7 +107,7 @@ func TestAddPeer(t *testing.T) { aer.Events[0].Item) c.InvokeFail(t, common.ErrWitnessFailed, "addPeer", dummyInfo.raw) - c.Invoke(t, stackitem.Null{}, "register", dummyInfo.raw) + c.Invoke(t, stackitem.Null{}, "addPeerIR", dummyInfo.raw) } func TestUpdateState(t *testing.T) { @@ -118,7 +118,7 @@ func TestUpdateState(t *testing.T) { dummyInfo := dummyNodeInfo(acc) cAcc.Invoke(t, stackitem.Null{}, "addPeer", dummyInfo.raw) - cNm.Invoke(t, stackitem.Null{}, "register", dummyInfo.raw) + cNm.Invoke(t, stackitem.Null{}, "addPeerIR", dummyInfo.raw) pub, ok := vm.ParseSignatureContract(acc.Script()) require.True(t, ok)