Skip to content

do not try another peer on a local error#440

Open
freemans13 wants to merge 3 commits intobsv-blockchain:mainfrom
freemans13:stu/do-not-try-another-peer-on-local-error
Open

do not try another peer on a local error#440
freemans13 wants to merge 3 commits intobsv-blockchain:mainfrom
freemans13:stu/do-not-try-another-peer-on-local-error

Conversation

@freemans13
Copy link
Collaborator

While running teratestnet and syncing, I could semaphore errors. blockvalidation was deciding the problem was with the peer and started over with a new peer. The problem in this instance was in my own teranode so it shouldn't pick another peer and possible downgrade the 'bad' peer.

@freemans13 freemans13 self-assigned this Jan 28, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 28, 2026

🤖 Claude Code Review

Status: Complete


Current Review:

Found a format string bug in 4 error messages (lines 572, 578, 609, 620) where each has one %s placeholder but passes two arguments. The error parameter will be ignored in the formatted message. See inline comment for details.

History:

  • ✅ Fixed: Function moved to errors package as requested

@freemans13 freemans13 requested a review from icellan January 28, 2026 11:16
@freemans13 freemans13 added the bug Something isn't working label Jan 28, 2026
// Local errors include context cancellation, semaphore exhaustion, and storage errors
// that are caused by local resource constraints rather than peer failures.
// These errors should not trigger peer failover since trying another peer won't help.
func isLocalError(err error) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to Error package?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
// Check if error is local (not peer-related) - don't retry with other peers
if errors.IsLocalError(err) {
return errors.NewServiceError("[catchup:fetchAndStoreSubtreeAndSubtreeData] Local error fetching subtreeData for %s (not retrying with other peers)", subtreeHash.String(), err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Format string bug: has one %s placeholder but passes two arguments (hash and err). The error will be ignored. Need to add %v placeholder for the error.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 2, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
61.1% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants