mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:50:37 +00:00
validation: don't report unstored blocks as new #37028
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!37028
Loading…
Reference in a new issue
No description provided.
Delete branch "l0rinc/new-block-flag-after-storage"
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?
Problem: When a block write fails,
AcceptBlockhas already set the new-block flag, so the peer manager still updates the peer's last-block time and clears any in-flight request for the block.Fix: Set the flag only after recording the stored block's position in the block index.
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.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
🟠 Minor ·
bitcoin-chainstatemislabels a failed block write as a duplicateThe experimental
bitcoin-chainstatedemo now prints “Block is a duplicate” for a first-time block whose write fails, extending its pre-existing misclassification of validation failures.Location:
src/validation.cpp:4471(head).🔵 Suggestion · The
new_blockAPI docs still describe receipt rather than storageThe
ProcessNewBlockand kernel API docs still describe first receipt or processing, although a first-time block whose write fails now leavesnew_blockfalse.Location:
src/validation.cpp:4471(head).Reviewed:
074945e50672· Review report · Previous reportspermalink
tACK
074945e506Verified that the test catches the block write failure and that the flag is only set after the block has been successfully written.
nit: You might want to mention in the PR description that it also adds test coverage for failed block writes.
tACK
074945e506After this PR, we no longer set
fNewBlockbefore a successful disk write. This assures thatPeerManagerno longer treats a failed store like a new block.For a follow-up, could consider a test of this behavior from the
PeerManagerside.