fix: add SendState to determine when to abort Send
This commit adds a new SendState struct, which is used internally by the txmgr to determine if we should give up on a particular tx at the given nonce due to ErrNonceTooLow failures. To do so, we track the set of mined txns at any particular time, which are updated via asynchronous calls to TxMined and TxNotMined by each of the spawned goroutines. The presence of a mined txn supercedes any of the errors returned, and will cause the txmgr to wait for full confirmation. However, if we observe multiple ErrNonceTooLows, the SendState will wait for a configurable safe abort count to ensure that the reading wasn't due to being in a transient state, as we don't have exact guarantees on the execution ordering of various goroutines. With this change, the test added in the prior commit now succeeds.
Showing
Please register or sign in to comment