Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Handle block reorgs appropriately #6

Open
icook opened this issue Dec 14, 2014 · 0 comments
Open

Handle block reorgs appropriately #6

icook opened this issue Dec 14, 2014 · 0 comments

Comments

@icook
Copy link
Owner

icook commented Dec 14, 2014

This is mostly tough because testing it is somewhat tricky. Either setup complete testing infrastructure and mock everything (time consuming) or do a one off test with testnet in a box and three nodes.

Either way, to be fully featured this is completely necessary. Steps would be approximately:

  1. Check if highest indexed block hash is equal to what the RPC server has for that height.
  2. If not, go backwards and continue comparing until you get a match. Each block that doesn't match needs to:
    1. Be marked as Orphan
    2. Have all linked Transactions remove their block reference.
    3. Add new entry to the "seen in" many to many between blocks and transactions
    4. Update confirmation status of the Transaction (if we start caching this).
  3. Once common ancestor is reached sync as normal.

Doing this after #4 and #1 seems prudent.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant