check_nonce_mismatch

Documentation for eth_defi.confirmation.check_nonce_mismatch function.

check_nonce_mismatch(web3, txs, retries=3, retry_delay=datetime.timedelta(seconds=1))

Check for nonce re-use issues.

Compare pre-signed transactions with on-chain addresses’ nonce states. The nonce is owned solely by our internal hot wallet counter, so the on-chain nonce must match our expected nonce exactly — strict equality is intentional and preserved.

The happy path is a single get_transaction_count read (unchanged). Only when that first read disagrees do we re-sample every fallback node and trust the most up-to-date one (highest block number): on an eventually-consistent multi-node RPC a single node can lag a transaction behind and return a stale count, which previously crashed the live loop. We raise only if the mismatch persists on the most-advanced node across all retries — a genuine desync — and include a per-node block/nonce diagnostic so the lagging node is obvious. See deps/web3-ethereum-defi/docs/README-hyperevm-goldsky-failure.md.

Parameters
Raises

NonceMismatch – If the most up-to-date node still disagrees with our expected nonce after retries, or duplicate nonces appear in the same batch.