-
Notifications
You must be signed in to change notification settings - Fork 40
feat: note the canonical bitcoin blocks in the database #1891
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
Open
djordon
wants to merge
39
commits into
main
Choose a base branch
from
1889-note-the-canonical-bitcoin-blocks-in-the-database
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
a7ae33a
Add the postgres queries that update the status of bitcoin blocks
djordon c6cb8eb
Update the in-memory database
djordon 51299a6
Update bitcoin blocks in the block observer
djordon 68e4de0
Add a new column for canonical blocks
djordon 19de032
use a better name for the new trait query
djordon 7c37e5d
change the behavior of the update function
djordon d577cf2
Add two integration tests for the new query
djordon d5ef4e0
fix up the postgres tests by moving the helper function to a more cen…
djordon c94649a
add a block observer test
djordon 0d10f72
cargo clippy fixes
djordon 1e261ef
update the field comment
djordon 479d888
fix load_latest_deposit_requests_persists_requests_from_past, hopefully
djordon 78b0d28
generate the blocks after invalidation differently
djordon 233b3fd
this wasn't importable or something, quick fix
djordon 0c61eb9
Okay, this can cause problems if some test fails
djordon 1bdc690
bitcoin-core sensitivity or something?
djordon ca0b237
ask for the chain tip after invalidation
djordon 685ab43
Let's try sleeping, twice and invalidating twice
djordon a3fbcf0
4 second sleep?
djordon dad31d6
generate blocks to a new random address
djordon 2d6a913
Update the comments
djordon 8ea706d
Simplify the two queries into one
djordon 2b5494a
only call set_canonical_bitcoin_blockchain in a new function designed…
djordon 68a6c7f
Merge branch 'main' into 1889-note-the-canonical-bitcoin-blocks-in-th…
djordon 4a7522e
apparently, this was lost in the merge
djordon ea231ed
We need to make sure stacks blocks are anchored to bitcoin blocks on …
djordon 2662d9d
slight simplification
djordon 726d0ea
forgot to clear the in-memory canonical blocks
djordon 7185893
cleaner block generation in fork_at_height
djordon 69b5698
Just add another transaction instead of
djordon 43feedd
update a comment
djordon 5f18035
add an additional check for canonicalness in one of the tests
djordon d2fff18
comment update
djordon a986773
parameterize the test
djordon 7d313ff
cargo fmt
djordon 0cd2e05
Merge branch 'main' into 1889-note-the-canonical-bitcoin-blocks-in-th…
djordon a2d57b9
Use the new testcontainer infra
djordon c8d7896
add another test using testdata
djordon 69bcd3c
re-order the tests
djordon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
signer/migrations/0021__add_is_canonical_to_bitcoin_blocks.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| -- Add is_canonical column to bitcoin_blocks table to track which blocks | ||
| -- are on the canonical Bitcoin blockchain. | ||
|
|
||
| ALTER TABLE sbtc_signer.bitcoin_blocks | ||
| ADD COLUMN is_canonical BOOLEAN; | ||
|
|
||
| -- Create an index on is_canonical for efficient queries filtering | ||
| -- canonical vs non-canonical blocks. | ||
| CREATE INDEX ix_bitcoin_blocks_is_canonical ON sbtc_signer.bitcoin_blocks(is_canonical); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.