kernel: trim Chain interface #33820

pull stickies-v wants to merge 2 commits into bitcoin:master from stickies-v:2025-11/kernel-trim-chain-interface changing 3 files +2 −33
  1. stickies-v commented at 4:50 pm on November 7, 2025: contributor

    Removes btck_chain_get_genesis and btck_chain_get_tip.

    They are trivially replaced with btck_chain_get_by_height (as indicated in the updated bitcoinkernel_wrapper.h), so I think it makes sense to trim the interface.

    For btck_chain_get_tip: on master we don’t provide any guarantees that the returned block index still corresponds to the actual tip, so the extra call doesn’t seem like a regression to me.

  2. kernel: remove btck_chain_get_genesis
    It is equivalent to calling btck_chain_get_by_height(0).
    737b6566f6
  3. kernel: remove btck_chain_get_tip
    It is equivalent to calling btck_chain_get_by_height with the
    height obtained from btck_chain_get_height. In neither case do we
    provide guarantees that the returned block index still corresponds
    to the actual tip.
    f4b3ba18d9
  4. DrahtBot added the label Validation on Nov 7, 2025
  5. DrahtBot commented at 4:51 pm on November 7, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33820.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK yuvicc
    Concept ACK TheCharlatan

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  6. yuvicc commented at 2:32 pm on November 8, 2025: contributor

    ACK f4b3ba18d9bf3e7c2c55a98f3c3d98129a1fa6e2

    This makes sense to me.

  7. in src/kernel/bitcoinkernel_wrapper.h:970 in f4b3ba18d9
    968@@ -969,7 +969,7 @@ class ChainView : public View<btck_Chain>
    969 
    970     BlockTreeEntry Tip() const
    


    TheCharlatan commented at 10:23 pm on November 8, 2025:
    I wonder if we should even keep these methods now. The previous calls to tip and genesis were at least thread safe (which these are no longer). I agree that it is not worth keeping them just for the sake of it, but also not sure if they still provide utility here.
  8. TheCharlatan commented at 10:24 pm on November 8, 2025: contributor

    Concept ACK

    These were introduced before we had a dedicated iterator for traversing the chain. At this point, their benefit (thread safety) is kind of marginal.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-11-09 21:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me