mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:50:37 +00:00
interfaces: fix findAncestorByHash false positive #36473
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36473
Loading…
Reference in a new issue
No description provided.
Delete branch "2026-10-fix-findancestorbyhash"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
findAncestorByHash looks up both block_hash and ancestor_hash, then was
only supposed to clear the ancestor pointer when the lookups succeeded
but the ancestor relationship didn't hold:
Because of the
&&short circuit, an unknownblock_hashmakes thewhole condition false without ever evaluating the relationship check,
so a successful
ancestor_hashlookup is passed through unmodifiedand the function reports
truefor a descendant that doesn't exist.Before:
After this change it correctly returns
falsewhen either hash isunknown, in addition to the existing relationship check.
Tested with:
Full suite (
./build/bin/test_bitcoin, 877 cases) also passes with noregressions. Added two new cases to
interfaces_tests/findAncestorByHashcovering unknown
block_hashand unknownancestor_hash, which failon master and pass with this fix.
Fixes #36472
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
A summary of reviews will appear here.
This seems to be a drive-by LLM contribution from an issue that was created not even an hour ago. Closing again.
Base:
282a05b8d10e317d2ce4b42b96ee8b13345804eaHead:
ccea7c93f5d8a54516a4bfe74d36486eac6c9e11I found no actionable issues in this static review.
Full review report