diff --git a/.changelog/5972.trivial.md b/.changelog/5972.trivial.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/go/consensus/api/submission.go b/go/consensus/api/submission.go index 9cbbcc1de8f..6c67f0a10c7 100644 --- a/go/consensus/api/submission.go +++ b/go/consensus/api/submission.go @@ -176,6 +176,11 @@ func (m *submissionManager) signAndSubmitTx(ctx context.Context, signer signatur err = m.backend.SubmitTx(ctx, sigTx) } if err != nil { + // If the transaction check fails (which cannot be determined from + // the error), the nonce in the cache should be either decremented + // or cleared to ensure consistency. + m.clearSignerNonce(signerAddr) + switch { case errors.Is(err, transaction.ErrUpgradePending): // Pending upgrade, retry submission. @@ -183,7 +188,6 @@ func (m *submissionManager) signAndSubmitTx(ctx context.Context, signer signatur return nil, nil, err case errors.Is(err, transaction.ErrInvalidNonce): // Invalid nonce, retry submission. - m.clearSignerNonce(signerAddr) m.logger.Debug("retrying transaction submission due to invalid nonce", "account_address", signerAddr, "nonce", tx.Nonce,