fix: add default case to handleHaves select to prevent reactor halt (backport #2813)#2941
Merged
ninabarbakadze merged 2 commits intov0.39.x-celestiafrom Apr 17, 2026
Merged
Conversation
…2813) ## Summary - Add a `default` case to the `select` statement in `handleHaves` (`consensus/propagation/have_wants.go`) so that when the per-peer `receivedHaves` channel is full, the message is dropped instead of blocking the propagation reactor's single message-processing goroutine. - This matches the existing non-blocking pattern already used in `handleRecoveryPart` in the same file. - Add a regression test `TestHandleHavesDoesNotBlock` that fills the channel to capacity and asserts `handleHaves` returns promptly. ## Test plan - [x] `go test -v -run TestHandleHavesDoesNotBlock -count=1 ./consensus/propagation/` passes - [x] Full `go test ./consensus/propagation/...` passes Closes CELESTIA-185 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> (cherry picked from commit bd5fa67)
| index: uint32(index), | ||
| }: | ||
| p.RequestsReady() | ||
| default: |
There was a problem hiding this comment.
🟡 Missing required changelog entry for this bug fix PR
Both CLAUDE.md and CONTRIBUTING.md require every PR to include a changelog entry at .changelog/unreleased/{category}/{issue-or-pr-number}-{description}.md. This PR (a bug fix adding a default case to prevent reactor blocking) does not include a changelog entry under .changelog/unreleased/bug-fixes/. The commit message references PR #2813, so a file like .changelog/unreleased/bug-fixes/2813-prevent-handlehaves-reactor-halt.md is expected.
Prompt for agents
The repository rules in CLAUDE.md and CONTRIBUTING.md both require a changelog entry for every PR. This is a bug fix, so a file should be created at .changelog/unreleased/bug-fixes/2813-prevent-handlehaves-reactor-halt.md (or using the PR number 2941). The file should contain a description like:
- [consensus/propagation] \#2813 Add default case to handleHaves select to prevent a malicious peer from blocking the propagation reactor's message-processing goroutine (@contributor)
See existing examples in .changelog/unreleased/ for formatting guidance.
Was this helpful? React with 👍 or 👎 to provide feedback.
ninabarbakadze
approved these changes
Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
defaultcase to theselectstatement inhandleHaves(consensus/propagation/have_wants.go) so that when the per-peerreceivedHaveschannel is full, the message is dropped instead of blocking the propagation reactor's single message-processing goroutine.handleRecoveryPartin the same file.TestHandleHavesDoesNotBlockthat fills the channel to capacity and assertshandleHavesreturns promptly.Test plan
go test -v -run TestHandleHavesDoesNotBlock -count=1 ./consensus/propagation/passesgo test ./consensus/propagation/...passesCloses CELESTIA-185
🤖 Generated with Claude Code
This is an automatic backport of pull request #2813 done by Mergify.