From b27c72c02a6328b6f243dc6b4092d2a2de24bbbb Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Sun, 28 Nov 2021 12:43:03 +0300 Subject: [PATCH] [#973] morph/subnet: Fix docs and comments of notification events Signed-off-by: Leonard Lyubich --- pkg/morph/event/subnet/delete.go | 2 +- pkg/morph/event/subnet/put.go | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pkg/morph/event/subnet/delete.go b/pkg/morph/event/subnet/delete.go index 5d2a3def9..e23f3a473 100644 --- a/pkg/morph/event/subnet/delete.go +++ b/pkg/morph/event/subnet/delete.go @@ -28,7 +28,7 @@ func (x Delete) ID() []byte { } // TxHash returns hash of the transaction which thrown the notification event. -// Makes sense only in non-notary environments (see NotaryMainTx). +// Makes sense only in notary environments. func (x Delete) TxHash() util.Uint256 { return x.txHash } diff --git a/pkg/morph/event/subnet/put.go b/pkg/morph/event/subnet/put.go index ed962d101..790573704 100644 --- a/pkg/morph/event/subnet/put.go +++ b/pkg/morph/event/subnet/put.go @@ -19,7 +19,7 @@ type Put struct { id []byte - ownerID []byte + owner []byte info []byte } @@ -32,9 +32,9 @@ func (x Put) ID() []byte { return x.id } -// Owner returns subnet owner's ID in a binary format of NeoFS API protocol. +// Owner returns subnet owner's public key in a binary format. func (x Put) Owner() []byte { - return x.ownerID + return x.owner } // Info returns information about the subnet in a binary format of NeoFS API protocol. @@ -43,7 +43,7 @@ func (x Put) Info() []byte { } // TxHash returns hash of the transaction which thrown the notification event. -// Makes sense only in non-notary environments (see NotaryMainTx). +// Makes sense only in notary environments. func (x Put) TxHash() util.Uint256 { return x.txHash } @@ -87,12 +87,12 @@ func ParsePut(e *subscriptions.NotificationEvent) (event.Event, error) { } // parse owner - put.ownerID, err = client.BytesFromStackItem(items[1]) + put.owner, err = client.BytesFromStackItem(items[1]) if err != nil { return nil, fmt.Errorf("owner item: %w", err) } - // parse public key + // parse info about subnet put.info, err = client.BytesFromStackItem(items[2]) if err != nil { return nil, fmt.Errorf("info item: %w", err) @@ -125,16 +125,19 @@ func ParseNotaryPut(e event.NotaryEvent) (event.Event, error) { return nil, event.WrongNumberOfParameters(itemNumPut, ln) } + // parse info about subnet put.info, err = event.BytesFromOpcode(prms[0]) if err != nil { return nil, fmt.Errorf("info param: %w", err) } - put.ownerID, err = event.BytesFromOpcode(prms[1]) + // parse owner + put.owner, err = event.BytesFromOpcode(prms[1]) if err != nil { return nil, fmt.Errorf("creator param: %w", err) } + // parse ID put.id, err = event.BytesFromOpcode(prms[2]) if err != nil { return nil, fmt.Errorf("id param: %w", err)