Skip to content

Fast restarts cause the same nonce to be sent twice #43

@yahgwai

Description

@yahgwai

This would also be true for concurrent starts of both multinonce and bitflip, since neither takes into account in-flight transactions.

To fix this we could emit an event from the Forwarder which includes the nonce. So that we can then inspect the mempool for these events to find the current nonce, this would also make the start up logic much simpler as we can always just use the latest log. Eg the following should be enough:

const relevantLogs = await provider.getLogs({ ...eventFilter, fromBlock: 0, toBlock: "pending" })
const latestNonce = decode(relevantLogs[relevantLogs.length - 1]).indexAndNonce;

Although infura will only return a maximum of 10000 results, so it may need to do fromBlock === currentBlock - 1000, and if no logs are found we go back further in time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions