diff --git a/CHANGELOG.md b/CHANGELOG.md index 65e22a00d7..3bce7c267e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ Changelog for NeoFS Node - Concurrent mode changes in the metabase and blobstor (#2057) - Panic in IR when performing HEAD requests (#2069) - Write-cache flush duplication (#2074) +- Ignore error if a transaction already exists in a morph client (#2075) ### Removed ### Updated diff --git a/pkg/morph/client/notary.go b/pkg/morph/client/notary.go index 26d5717154..2c0cbed523 100644 --- a/pkg/morph/client/notary.go +++ b/pkg/morph/client/notary.go @@ -13,6 +13,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/crypto/hash" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/encoding/fixedn" + "github.com/nspcc-dev/neo-go/pkg/neorpc" "github.com/nspcc-dev/neo-go/pkg/smartcontract" sc "github.com/nspcc-dev/neo-go/pkg/smartcontract" "github.com/nspcc-dev/neo-go/pkg/util" @@ -175,7 +176,18 @@ func (c *Client) DepositNotary(amount fixedn.Fixed8, delta uint32) (res util.Uin big.NewInt(int64(amount)), []interface{}{c.acc.PrivateKey().GetScriptHash(), till}) if err != nil { - return util.Uint256{}, fmt.Errorf("can't make notary deposit: %w", err) + if !errors.Is(err, neorpc.ErrAlreadyExists) { + return util.Uint256{}, fmt.Errorf("can't make notary deposit: %w", err) + } + + // Transaction is already in mempool waiting to be processed. + // This is an expected situation if we restart the service. + c.logger.Debug("notary deposit has already been made", + zap.Int64("amount", int64(amount)), + zap.Int64("expire_at", till), + zap.Uint32("vub", vub), + zap.Error(err)) + return util.Uint256{}, nil } c.logger.Debug("notary deposit invoke",