kernel: expose contextual block validation (`TestBlockValidity()`) #35726

pull yuvicc wants to merge 2 commits into bitcoin:master from yuvicc:2026-7-expose_test_block_validity changing 4 files +86 −7
  1. yuvicc commented at 7:22 AM on July 15, 2026: contributor

    The kernel library currently exposes two API for block validation:

    • btck_block_check : context-free checks only, and
    • btck_chainstate_manager_process_block : full validation that also connects the block, persists it to disk, updates indexes and fires notifications.

    We could expose TestBlockValidity() using btck_chainstate_manager_test_block_validity that would fully validate a block in the context of current tip and that doesn't commit it. This could be beneficial for mining softwares and for testing purpose that would do contextual header/block checks and full script/UTXO validation as read only operation.

  2. kernel: add btck_chainstate_manager_test_block_validity
    Expose a contextual block validation entry point in the kernel C API that
    checks whether a block would be valid as the next block on top of the current
    active tip, without connecting it, wrapping the existing `TestBlockValidity()`.
    d48e43557e
  3. test: add test for btck_chainstate_manager_test_block_validity e79701ee29
  4. DrahtBot added the label Validation on Jul 15, 2026
  5. DrahtBot commented at 7:22 AM on July 15, 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/35726.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  6. ismaelsadeeq commented at 9:12 AM on July 15, 2026: member

    Won't hurt, but I am concept ~0 motivation is not satisfying.

    This could be beneficial for mining softwares

    I think mining software uses the mining interface, which exposes checkblock. How is this better than that? Even the exposed checkblock IPC interface is likely not going to be used because it's context-heavy and not ideal when you want to validate a lot of block template proposals really fast. There is a better idea #35671 that is bandwidth-efficient and faster.

    for testing purpose that would do contextual header/block checks and full script/UTXO validation as read only operation.

    Seems useful, but still weak motivation imo, I'd rather we expose #35187, technically u can simulate the testing purpose you describe here with #35187, and it has a very important usecase which is validating block without the context of the current tip.

  7. yuvicc commented at 5:25 AM on July 18, 2026: contributor

    I think mining software uses the mining interface, which exposes checkblock. How is this better than that? Even the exposed checkblock IPC interface is likely not going to be used because it's context-heavy and not ideal when you want to validate a lot of block template proposals really fast. There is a better idea #35671 that is bandwidth-efficient and faster.

    I think that makes sense, will lean towards #35187. Thanks, closing this for now.

  8. yuvicc closed this on Jul 18, 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-07-21 17:50 UTC

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