kernel: align height parameters to int32_t in btck API #35096

pull alexanderwiederin wants to merge 2 commits into bitcoin:master from alexanderwiederin:btck_api_int changing 3 files +11 −5
  1. alexanderwiederin commented at 8:59 AM on April 17, 2026: contributor

    Follow-up to #34885 (review)

    Summary

    Align height-related parameters and return values in the kernel API to use int32_t.

    Motivation

    The convention in the API is to use fixed-width types like int32_t for data values (e.g. heights), and plain int/unsigned int for boolean-like values and flags. Two functions were not following this:

    • btck_chain_get_height: header declared int32_t but implementation used int
    • btck_chain_get_by_height: both header and implementation used plain int

    Changes

    • btck_chain_get_height: align .cpp to match header (int -> int32_t)
    • btck_chain_get_by_height: update both header and .cpp (int -> int32_t)
    • CountEntries in bitcoinkernel_wrapper.h: align return type to int32_t
    • GetByHeight in bitcoinkernel_wrapper.h: align parameter type to int32_t
    • Document integer type conventions in the @page remarks section of bitcoinkernel.h

    Note: This is technically a breaking change for C consumers who have function pointer declarations matching the old signature. The Rust, Go, Java and Python bindings should not be affected.

  2. DrahtBot added the label Validation on Apr 17, 2026
  3. DrahtBot commented at 8:59 AM on April 17, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK musaHaruna, sedited, stringintech
    Concept ACK stickies-v

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. stickies-v commented at 2:19 PM on April 17, 2026: contributor

    Concept ACK. Might be useful to document this in the @page remarks section? The c++ wrapper looks like it should be updated too.

  5. kernel: align height parameters to int32_t in btck API
    Aligns btck_chain_get_height and btck_chain_get_by_height to use int32_t
    for height parameters and return values. Updates the C++ wrapper
    accordingly.
    ba6287a449
  6. doc: add integer type conventions in btck api remarks 07b9b13b45
  7. alexanderwiederin force-pushed on Apr 17, 2026
  8. musaHaruna commented at 8:41 AM on April 20, 2026: contributor

    Code review ACK 07b9b13

    Changes look good to me. The switch to int32_t for height-related parameters and return values aligns with the documented type conventions and improves consistency across the API.

    Verified that declarations and implementations are consistent, and wrapper updates match the API.

    The breaking change for C consumers is noted and seems acceptable given the API goals.

  9. DrahtBot requested review from stickies-v on Apr 20, 2026
  10. sedited approved
  11. sedited commented at 12:45 PM on April 20, 2026: contributor

    ACK 07b9b13b45fa3e9197f992c55d0ca94c964f4fc4

  12. stringintech commented at 1:48 PM on April 20, 2026: contributor

    ACK 07b9b13

    Perhaps as a follow-up we can also document that we use size_t for container sizes and indices, and address any inconsistencies.

  13. fanquake merged this on Apr 20, 2026
  14. fanquake closed this on Apr 20, 2026


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: 2026-04-21 09:12 UTC

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