mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-25 13:24:53 +02:00
df44afdc98kernel: expose btck_block_tree_entry_get_ancestor (Peter Zafonte) Pull request description: Callers building a block locator from a stale tip currently have to walk back one entry at a time using btck_block_tree_entry_get_previous. For large step sizes this means hundreds of C API calls per locator entry. This exposes GetAncestor via btck_block_tree_entry_get_ancestor, which uses the existing CBlockIndex skiplist to reach any ancestor height in O(log N) and works on any chain, not just the active chain. Includes a C++ convenience wrapper and tests ~~covering same-height, genesis, and out-of-range cases~~ in btck_block_tree_entry_tests. See previous discussion here #34843 ACKs for top commit: alexanderwiederin: ACKdf44afdc98sedited: ACKdf44afdc98Tree-SHA512: e953b634235129fa972e7f148016e8aee7bad61e16d50191d6724d11c71fe0f7623152ff61aa4c4ec5c8a5b500aaeb36613b5b2ff1e404d01ed7b65aa861f7aa