[#971] *: Add notification TX hash to neofsid morph client calls

Add hash of the TX that generated notification
to neofsid event structures. Adapt all
neofsid wrapper calls to new structures.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-11-11 11:59:14 +03:00 committed by Alex Vanin
parent 404c62c5c4
commit 822d73fb02
5 changed files with 37 additions and 3 deletions

View file

@ -4,6 +4,7 @@ import (
"fmt"
"github.com/nspcc-dev/neo-go/pkg/rpc/response/result/subscriptions"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
@ -16,6 +17,17 @@ type Bind struct {
type bindCommon struct {
user []byte
keys [][]byte
// txHash is used in notary environmental
// for calculating unique but same for
// all notification receivers values.
txHash util.Uint256
}
// TxHash returns hash of the TX with new epoch
// notification.
func (b bindCommon) TxHash() util.Uint256 {
return b.txHash
}
// MorphEvent implements Neo:Morph Event interface.
@ -41,6 +53,8 @@ func ParseBind(e *subscriptions.NotificationEvent) (event.Event, error) {
return nil, err
}
ev.txHash = e.Container
return ev, nil
}