From c2c509620e12bfc9ac90053b0a0882d6fcedf071 Mon Sep 17 00:00:00 2001 From: Intizar Date: Wed, 28 Aug 2024 12:05:53 +0900 Subject: [PATCH] dont get new nonce in the last iteration --- node/pkg/chain/helper/helper.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/node/pkg/chain/helper/helper.go b/node/pkg/chain/helper/helper.go index d6f11a67c..b658a2854 100644 --- a/node/pkg/chain/helper/helper.go +++ b/node/pkg/chain/helper/helper.go @@ -283,6 +283,8 @@ func (t *ChainHelper) submitDelegated(ctx context.Context, contractAddress strin clientIndex = (clientIndex + 1) % len(t.clients) } else if errors.Is(err, errorSentinel.ErrChainTransactionFail) { return err, false // if transaction fails, the data will probably be too old to retry + } else if i == maxRetrial-1 { + return err, true // dont get new nonce if it's the last iteration, instead try direct transaction } else if utils.IsNonceError(err) || err == context.DeadlineExceeded { nonce, err = noncemanager.GetAndIncrementNonce(t.wallet) if err != nil { @@ -321,6 +323,8 @@ func (t *ChainHelper) submitDirect(ctx context.Context, contractAddress string, clientIndex = (clientIndex + 1) % len(t.clients) } else if errors.Is(err, errorSentinel.ErrChainTransactionFail) { return err // if transaction fails, the data will probably be too old to retry + } else if i == maxRetrial-1 { + return err // dont get new nonce if it's the last iteration } else if utils.IsNonceError(err) || err == context.DeadlineExceeded { nonce, err = noncemanager.GetAndIncrementNonce(t.wallet) if err != nil {