[#834] neofs-adm: Update contract update if it exists

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-09-21 15:18:06 +03:00 committed by Alex Vanin
parent 60636d4c1d
commit 6b3a9e6fcc

View file

@ -134,7 +134,7 @@ func (c *initializeContext) deployContracts(method string) error {
// alphabet contracts should be deployed by individual nodes to get different hashes.
for i, acc := range c.Accounts {
ctrHash := state.CreateContractHash(acc.Contract.ScriptHash(), alphaCs.NEF.Checksum, alphaCs.Manifest.Name)
if _, err := c.Client.GetContractStateByHash(ctrHash); err == nil {
if _, err := c.Client.GetContractStateByHash(ctrHash); err == nil && method != "migrate" {
c.Command.Printf("Alphabet contract #%d is already deployed.\n", i)
continue
}
@ -179,7 +179,7 @@ func (c *initializeContext) deployContracts(method string) error {
for _, ctrName := range contractList {
cs := c.Contracts[ctrName]
if _, err := c.Client.GetContractStateByHash(cs.Hash); err == nil {
if _, err := c.Client.GetContractStateByHash(cs.Hash); err == nil && method != "migrate" {
c.Command.Printf("%s contract is already deployed.\n", ctrName)
continue
}