Draft
Conversation
Member
Author
|
cc @0xB10C |
Davidson-Souza
requested changes
Feb 25, 2026
| @@ -0,0 +1,125 @@ | |||
| """ | |||
Member
There was a problem hiding this comment.
This test could generate some forks to test with more than one tip
tests/test_framework/rpc/base.py
Outdated
| """ | ||
|
|
||
| TIMEOUT: int = 15 # seconds | ||
| TIMEOUT: int = 30 # seconds |
5fe93cd to
cdeee33
Compare
Member
Author
|
Turning this back on draft. Im expanding this to contain the suggested test case but i need #881 for that.
Another piece that i have to push expands |
Implement the getchaintips RPC method that returns information about all known tips in the block tree, including the main chain and orphaned branches. - Add ChainTipStatus enum and ChainTip struct to floresta-rpc types - Add get_chain_tips() to FlorestaRPC trait - Add server-side handler in floresta-node json_rpc - Wire dispatch for "getchaintips" in the JSON-RPC server - Add doc/rpc/getchaintips.md documentation
Add integration test exercising `getchaintips` on both florestad and bitcoind, comparing their outputs across six scenarios. A) Genesis only B) Synced 10-block chain C) submit_header for an unknown block D) invalidateblock to produce an invalid tip E) Fork via invalidation at height 5 + mining 10 new blocks F) Second fork via invalidation at height 8 + mining 10 more Add get_chain_tips, invalidate_block and submit_header wrappers to the BitcoinRPC class so bitcoind can be exercised in the same way.
…ing block validation state, Add ChainTipInfo and ChainTipStatus types to floresta-chain so that get_chain_tips() returns validation state (Active, ValidFork, HeadersOnly, Invalid) alongside each tip hash. mark_chain_as_active: preserve FullyValid status for blocks that were already validated instead of overwriting as HeadersOnly. reorg: properly manage alternative_tips during chain reorganizations. Remove entries that become ancestors of the new active chain, and only add the old active tip when it is a true leaf (not an ancestor of any existing alternative tip). getchaintips: fix branchlen calculation by using a FindFork-style ancestor walk that checks heights are within the active chain, preventing stale block index entries from producing branchlen=0.
cdeee33 to
c5e7304
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description and Notes
This pr adds the
getchaintipsmethod with integration tests.There was already an
BlockChainInterface::get_chain_tips()which returned the known tips, i just had to identify each blockhash and return data about its state.addresses: #858
I also changed the timeout to 30 seconds because my pc struggled with the tests. It would be nice to get it merged, but i understand thats already being handled on #794 and i can remove it later.
How to verify the changes you have done?