Skip to content

interfaces: findAncestorByHash returns true for an unknown descendant #36472

Open

Description

@enochaz

Is there an existing issue for this?

  • I have searched the existing issues

Current behaviour

While testing an external python capnp ipc client on regtest, I found that findAncestorByHash returns success for an unknown descendant hash when the ancestor is known. I also reproduced this directly on master.

Expected behaviour

findAncestorByHash should return false when the descendant hash is unknown

Steps to reproduce

Add this to the existing findAncestorByHash test in src/test/interfaces_tests.cpp to reproduce the issue

BOOST_CHECK(!chain->findAncestorByHash(uint256{}, active[0]->GetBlockHash()));

and then running

cmake --build build --target test_bitcoin -j8 && ./build/bin/test_bitcoin --run_test=interfaces_tests/findAncestorByHash

Relevant log output

test/interfaces_tests.cpp:97: error: in "interfaces_tests/findAncestorByHash": check !chain->findAncestorByHash(uint256{}, active[0]->GetBlockHash()) has failed

How did you obtain Bitcoin Core

Compiled from source

What version of Bitcoin Core are you using?

v31.1

Operating system and version

MacOS 27.0.1 arm

Machine specifications

No response

Activity

  1. fanquake commented on Oct 8, 2026

    @fanquake
    Member
  2. psychemist commented on Oct 10, 2026

    @psychemist

    i followed this steps above to reproduce this issue:

    • added the failing findAncestorByHash test to src/test/interfaces_tests.cpp
    • rebuilt Core v32.99.0-d4b0e1e4b078 on my machine (macOS 15.8.01)
    • ran that specific test and got this result:
    Image
  3. Sjors commented on Oct 13, 2026

    @Sjors
    Member

    While testing an external python capnp ipc client on regtest

    How? Are you using #29409?

  4. enochaz commented on Oct 13, 2026

    @enochaz
    ContributorAuthor

    How? Are you using #29409?

    Yes, the python ipc client is using the chain interface in #29409, and then reproduced it separately on master

  5. ryanofsky commented on Oct 14, 2026

    @ryanofsky
    Contributor

    Thanks for the testing and report! I created #36520 to fix this and a few similar issues.

  6. added a commit that references this issue on Nov 5, 2026
    ff8ff34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions