kernel: expose block header Merkle root #36194

pull lucasdbr05 wants to merge 1 commits into bitcoin:master from lucasdbr05:kernel/header-merkle-root-utils changing 4 files +136 −0
  1. lucasdbr05 commented at 4:42 PM on September 8, 2026: none

    After participating in a deep-dive on libbitcoinkernel, I noticed that the BlockHeader API did not provide a simple way to access the Merkle root.

    This PR adds a method to the BlockHeader API to retrieve the Merkle root from a block header. It also introduces a wrapper for Merkle roots, including support for serialization to bytes, copying, destruction, and comparison, and adds tests to verify that the expected values are returned.

  2. kernel: Expose block header Merkle root
    Introduce btck_BlockMerkleRoot as a type-safe wrapper for a block's Merkle root. Adds functions to retrieve the Merkle root from a block header, copy and destroy it, check for equality, and serialize it to bytes.
    42a6ab2d74
  3. DrahtBot added the label Validation on Sep 8, 2026
  4. DrahtBot commented at 4:42 PM on September 8, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    Concept ACK sedited, stickies-v, jjamming

    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-->

  5. sedited commented at 6:04 PM on September 8, 2026: contributor

    Concept ACK

  6. DrahtBot added the label CI failed on Sep 8, 2026
  7. stickies-v commented at 7:17 PM on September 8, 2026: contributor

    Concept ACK.

    I think this should be a block_header instead of a block attribute, though. I'm also not sure we need a separate btck_BlockMerkleRoot type for this? Would a simple void btck_block_header_get_merkle_root(const btck_BlockHeader* header, unsigned char output[32]) not suffice?

  8. sedited commented at 7:41 PM on September 8, 2026: contributor

    Would a simple void btck_block_header_get_merkle_root(const btck_BlockHeader* header, unsigned char output[32]) not suffice?

    I think I'd prefer that too.

  9. jjamming commented at 3:23 AM on September 9, 2026: none

    Concept ACK


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-09-09 07:56 UTC