From 8178c5e69bfa8d8c3efa00ee8c7100b78300d425 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 19 Aug 2021 13:27:43 +0300 Subject: [PATCH] [#757] neofs-adm: ensure notary contract is enabled This is the only case we support, it makes sense to fail early. Signed-off-by: Evgenii Stratonikov --- cmd/neofs-adm/internal/modules/morph/initialize.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/neofs-adm/internal/modules/morph/initialize.go b/cmd/neofs-adm/internal/modules/morph/initialize.go index cbf98a630..6f2912280 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize.go @@ -7,6 +7,7 @@ import ( "path" "time" + "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/rpc/client" @@ -133,10 +134,17 @@ func newInitializeContext(cmd *cobra.Command, v *viper.Viper) (*initializeContex return nil, fmt.Errorf("can't get native contract hashes: %w", err) } + notaryEnabled := false nativeHashes := make(map[string]util.Uint160, len(ns)) for i := range ns { + if ns[i].Manifest.Name == nativenames.Notary { + notaryEnabled = len(ns[i].UpdateHistory) > 0 + } nativeHashes[ns[i].Manifest.Name] = ns[i].Hash } + if !notaryEnabled { + return nil, errors.New("notary contract must be enabled") + } accounts := make([]*wallet.Account, len(wallets)) for i, w := range wallets {