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

Depend on btc client (electrs) for canonical chain #374

Merged
merged 14 commits into from
Jan 15, 2025

Conversation

ClaytonNorthey92
Copy link
Contributor

@ClaytonNorthey92 ClaytonNorthey92 commented Jan 14, 2025

Summary
change chain-tracking paradigm

Changes

  • no longer calculate canonical chain in bfg
  • start from tip, walking backwards
  • upon startup walk backwards processing blocks to the start height, note that we only process txs in blocks that we have not seen
  • every 5 seconds, walk back from current tip, replacing blocks that are not in the canonical chain until we come accross one that we have seen
  • height is now unique in the btc blocks table
  • if a block is deleted, ensure we delete pop_basis rows in the db
  • move inserts to the end of btc block processing as to not be affected by electrs timeouts (they should also be atomic but they never were, that's for another day)

@github-actions github-actions bot added the area: bfg This is a change to BFG (Bitcoin Finality Governor) label Jan 14, 2025
* no longer calculate canonical chain in bfg
* start from tip, walking backwards
* upon startup walk backwards processing blocks to the start height, note that we only process txs in blocks that we have not seen
* every 5 seconds, walk back from current tip, replacing blocks that are not in the canonical chain until we come accross one that we have seen
* height is now unique in the btc blocks table
* if a block is deleted, ensure we delete pop_basis rows in the db
@ClaytonNorthey92 ClaytonNorthey92 changed the title Clayton/trust electrs Depend on btc client (electrs) for canonical chain Jan 15, 2025
@ClaytonNorthey92 ClaytonNorthey92 marked this pull request as ready for review January 15, 2025 02:41
@ClaytonNorthey92 ClaytonNorthey92 requested a review from a team as a code owner January 15, 2025 02:41
Copy link
Contributor

@marcopeereboom marcopeereboom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is just a bandaid as well. But let's get this in and march towards a new and fresh bfg.

@ClaytonNorthey92 ClaytonNorthey92 merged commit 5d1bf8f into main Jan 15, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: bfg This is a change to BFG (Bitcoin Finality Governor)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants