interfaces: fix findAncestorByHash returning true for unknown descendant #36484

pull Romansage6 wants to merge 1 commits into bitcoin:master from Romansage6:fix-findancestorbyhash-unknown-descendant changing 2 files +2 −1
  1. Romansage6 commented at 7:02 AM on October 9, 2026: none

    findAncestorByHash nulled out 'ancestor' only when the descendant block was also known, due to a 'block &&' guard. If block_hash didn't resolve to a known block, the guard short-circuited and the still-valid ancestor pointer was passed to FillBlock, causing the call to report success for an unknown descendant.

    checked the sibling functions findCommonAncestor and findAncestorByHeight for the same short-circuit pattern; both already default to a null result whenever either lookup fails, so no equivalent bug exists there.

    Extended the existing interfaces_tests/findAncestorByHash unit test with a regression assertion for an unknown descendant hash. Verified it fails without the fix and passes with it (./build/bin/test_bitcoin --run_test=interfaces_tests/findAncestorByHash).

    fixes #36472

  2. interfaces: fix findAncestorByHash returning true for unknown descendant
    findAncestorByHash nulled out 'ancestor' only when the descendant block was
    also known, due to a 'block &&' guard. If block_hash didn't resolve to a
    known block, the guard short-circuited and the still-valid ancestor pointer
    was passed to FillBlock, causing the call to report success for an unknown
    descendant.
    
    Add a regression assertion to the existing findAncestorByHash unit test.
    
    fixes #36472
    ac512d6f39
  3. DrahtBot added the label IPC on Oct 9, 2026
  4. DrahtBot commented at 7:02 AM on October 9, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. l0rinc commented at 7:31 AM on October 9, 2026: contributor

    Exact duplicate of #36473 (comment)

  6. maflcko closed this on Oct 9, 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-10-11 08:51 UTC

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