Skip to content

Commit

Permalink
dont get new nonce in the last iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
Intizar-T committed Aug 28, 2024
1 parent d1873d0 commit c2c5096
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions node/pkg/chain/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit c2c5096

Please sign in to comment.