[#971] *: Add notification TX hash to neofs/netmap morph client calls

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

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-11-10 14:05:51 +03:00 committed by Alex Vanin
parent c25f5a86ae
commit bad739258e
19 changed files with 220 additions and 60 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/neofs-node/pkg/morph/client"
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
)
@ -12,6 +13,17 @@ type Config struct {
key []byte
value []byte
id []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 (u Config) TxHash() util.Uint256 {
return u.txHash
}
// MorphEvent implements Neo:Morph Event interface.
@ -56,5 +68,7 @@ func ParseConfig(e *subscriptions.NotificationEvent) (event.Event, error) {
return nil, fmt.Errorf("could not get config value: %w", err)
}
ev.txHash = e.Container
return ev, nil
}