forked from TrueCloudLab/frostfs-node
[#755] neofs-adm: add contract hash flag to dump-containers
`--container-contract` flag must be used for deployments without NNS. Our current testnet sidechain is like this, for example. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
5072b703bc
commit
00a299c1a4
2 changed files with 12 additions and 2 deletions
|
@ -10,6 +10,7 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/io"
|
"github.com/nspcc-dev/neo-go/pkg/io"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
|
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag"
|
"github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag"
|
||||||
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/emit"
|
"github.com/nspcc-dev/neo-go/pkg/vm/emit"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
||||||
|
@ -35,9 +36,16 @@ func dumpContainers(cmd *cobra.Command, _ []string) error {
|
||||||
return fmt.Errorf("can't get NNS contract state: %w", err)
|
return fmt.Errorf("can't get NNS contract state: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ch, err := nnsResolveHash(c, nnsCs.Hash, containerContract+".neofs")
|
var ch util.Uint160
|
||||||
|
s, err := cmd.Flags().GetString(containerContractFlag)
|
||||||
|
if err == nil {
|
||||||
|
ch, err = util.Uint160DecodeStringLE(s)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("can't fetch container contract hash: %w", err)
|
ch, err = nnsResolveHash(c, nnsCs.Hash, containerContract+".neofs")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := c.InvokeFunction(ch, "list",
|
res, err := c.InvokeFunction(ch, "list",
|
||||||
|
|
|
@ -28,6 +28,7 @@ const (
|
||||||
withdrawFeeInitFlag = "network.fee.withdraw"
|
withdrawFeeInitFlag = "network.fee.withdraw"
|
||||||
withdrawFeeCLIFlag = "withdraw-fee"
|
withdrawFeeCLIFlag = "withdraw-fee"
|
||||||
containerDumpFlag = "dump"
|
containerDumpFlag = "dump"
|
||||||
|
containerContractFlag = "container-contract"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -169,6 +170,7 @@ func init() {
|
||||||
RootCmd.AddCommand(dumpContainersCmd)
|
RootCmd.AddCommand(dumpContainersCmd)
|
||||||
dumpContainersCmd.Flags().StringP(endpointFlag, "r", "", "N3 RPC node endpoint")
|
dumpContainersCmd.Flags().StringP(endpointFlag, "r", "", "N3 RPC node endpoint")
|
||||||
dumpContainersCmd.Flags().String(containerDumpFlag, "", "file where to save dumped containers")
|
dumpContainersCmd.Flags().String(containerDumpFlag, "", "file where to save dumped containers")
|
||||||
|
dumpContainersCmd.Flags().String(containerContractFlag, "", "container contract hash (for networks without NNS)")
|
||||||
|
|
||||||
RootCmd.AddCommand(restoreContainersCmd)
|
RootCmd.AddCommand(restoreContainersCmd)
|
||||||
restoreContainersCmd.Flags().String(alphabetWalletsFlag, "", "path to alphabet wallets dir")
|
restoreContainersCmd.Flags().String(alphabetWalletsFlag, "", "path to alphabet wallets dir")
|
||||||
|
|
Loading…
Reference in a new issue