mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:29:40 +00:00
interfaces: fix findAncestorByHash returning true for unknown descendant #36484
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!36484
Loading…
Reference in a new issue
No description provided.
Delete branch "fix-findancestorbyhash-unknown-descendant"
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 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
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.
Base:
4bacf21a13c2ed25ef9362ca38f26bf0a67d22c9Head:
ac512d6f396995f21b7b7599b397e562fa352fb1I found no actionable issues in this static review.
Full review report
Exact duplicate of https://github.com/bitcoin/bitcoin/pull/36473#issuecomment-6060602624