Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(oppool): Return reorged ops to the mempool #276

Merged
merged 1 commit into from
Aug 3, 2023
Merged

Commits on Aug 3, 2023

  1. feat(oppool): Return reorged ops to the mempool

    Previously, ops could be lost forever if they were mined into a block,
    but then that block got reorged away. Now, we detect reorgs and return
    any ops contained in them to our mempool.
    
    This requires some involved changes:
    
    * We replace the entire `events` mod and all its listeners. Instead, we
      introduce a new type, `Chain`, which represents our current knowledge
      of what blocks make up the blockchain.
    * We watch for the latest block hash to change. When it does, we read
      backwards from the latest block until we connect back to our known
      blocks, which lets us see any blocks that were replaced as well.
    * This process produces a `ChainUpdate` event, which is sent to the op
      pool (replacing `NewBlockEvent`). This may cause the op pool to not
      only remove mined ops but also restore unmined ops.
    * In order for the op pool to do so, it remembers mined ops for a time
      rather than deleting them fully. We add new methods to the op pool for
      restoring unmined blocks to make this possible.
    dphilipson committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    60db2a0 View commit details
    Browse the repository at this point in the history