Skip to content

[fix] Avoid AVAX Double Spend on Nonce Error

Ursa (9R) requested to merge ursa/avax-double-spend into develop

The nonce error currently returned by the Avalanche core library is not an exact match to the error returned in the Ethereum core library: https://github.com/ava-labs/coreth/blob/863207756ff6b53a1c6e66b6dad4500c9c89e18d/core/tx_pool.go#L658.

This updates to perform a string prefix match on the nonce error instead of the exact match. I do not see a site where the ErrAlreadyKnown error is returned within a format string, so I believe the existing string match is fine.

The slightly more robust method would be to use errors.Is with the error here, but that would require creating another dependency on the Avalanche core Ethereum library and I think the dependency bloat outweighs the win.

Edited by Ursa (9R)

Merge request reports