[#888] neofs-adm: use constant for update methods

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2021-10-07 16:32:11 +03:00 committed by Alex Vanin
parent 31b3c71457
commit f836e7c1dc

View file

@ -74,12 +74,12 @@ func (c *initializeContext) deployNNS(method string) error {
return err return err
} }
if _, err := c.Client.GetContractStateByHash(cs.Hash); err == nil && method != "update" { if _, err := c.Client.GetContractStateByHash(cs.Hash); err == nil && method != updateMethodName {
return nil return nil
} }
params := getContractDeployParameters(cs.RawNEF, cs.RawManifest, nil) params := getContractDeployParameters(cs.RawNEF, cs.RawManifest, nil)
if method == "update" { if method == updateMethodName {
params = params[:len(params)-1] // update has only NEF and manifest args params = params[:len(params)-1] // update has only NEF and manifest args
} }
@ -89,7 +89,7 @@ func (c *initializeContext) deployNNS(method string) error {
} }
mgmtHash := c.nativeHash(nativenames.Management) mgmtHash := c.nativeHash(nativenames.Management)
if method == "update" { if method == updateMethodName {
nnsCs, err := c.Client.GetContractStateByID(1) nnsCs, err := c.Client.GetContractStateByID(1)
if err != nil { if err != nil {
return fmt.Errorf("can't resolve NNS hash for contract update: %w", err) return fmt.Errorf("can't resolve NNS hash for contract update: %w", err)