[#225] netmap: Rename Register to AddPeerIR

Similar to `UpdateState`/`UpdateStateIR` pair.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-03-11 12:19:35 +03:00 committed by Alex Vanin
parent 9662f9f4db
commit a4f9d52cfc
3 changed files with 7 additions and 7 deletions

View file

@ -190,13 +190,13 @@ func UpdateInnerRing(keys []interop.PublicKey) {
common.SetSerialized(ctx, innerRingKey, irList) common.SetSerialized(ctx, innerRingKey, irList)
} }
// Register method tries to add new candidate to the network map. // AddPeerIR method tries to add new candidate to the network map.
// Should be invoked in notary-enabled environment by the alphabet. // Should only be invoked in notary-enabled environment by the alphabet.
func Register(nodeInfo []byte) { func AddPeerIR(nodeInfo []byte) {
ctx := storage.GetContext() ctx := storage.GetContext()
notaryDisabled := storage.Get(ctx, notaryDisabledKey).(bool) notaryDisabled := storage.Get(ctx, notaryDisabledKey).(bool)
if notaryDisabled { 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()) common.CheckAlphabetWitness(common.AlphabetAddress())

View file

@ -267,7 +267,7 @@ func TestContainerSizeEstimation(t *testing.T) {
} }
for i := range nodes { for i := range nodes {
cNm.WithSigners(nodes[i].signer).Invoke(t, stackitem.Null{}, "addPeer", nodes[i].raw) 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, // putContainerSize retrieves storage nodes from the previous snapshot,

View file

@ -107,7 +107,7 @@ func TestAddPeer(t *testing.T) {
aer.Events[0].Item) aer.Events[0].Item)
c.InvokeFail(t, common.ErrWitnessFailed, "addPeer", dummyInfo.raw) 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) { func TestUpdateState(t *testing.T) {
@ -118,7 +118,7 @@ func TestUpdateState(t *testing.T) {
dummyInfo := dummyNodeInfo(acc) dummyInfo := dummyNodeInfo(acc)
cAcc.Invoke(t, stackitem.Null{}, "addPeer", dummyInfo.raw) 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()) pub, ok := vm.ParseSignatureContract(acc.Script())
require.True(t, ok) require.True(t, ok)