Skip to content

clarify startup chain-mismatch warning and reduce log spam#245

Merged
dominicletz merged 1 commit intomasterfrom
clean-startup-chain-mismatch-warnings
Feb 26, 2026
Merged

clarify startup chain-mismatch warning and reduce log spam#245
dominicletz merged 1 commit intomasterfrom
clean-startup-chain-mismatch-warnings

Conversation

@tuhalf
Copy link
Copy Markdown
Collaborator

@tuhalf tuhalf commented Feb 25, 2026

Replace the vague block-header parent mismatch text with a clear message. Treat this startup mismatch as non-fatal in logs (relay skipped, others can validate). Log it as WARN once, then DEBUG for repeats to avoid repetitive warnings.

Replace the vague block-header parent mismatch text with a clear message.
Treat this startup mismatch as non-fatal in logs (relay skipped, others can validate).
Log it as WARN once, then DEBUG for repeats to avoid repetitive warnings.
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @tuhalf, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the handling of block header chain mismatches during client startup. The primary goal is to improve diagnostic clarity by providing a more informative error message and to reduce log verbosity by demoting repeated warnings to debug messages. This change ensures that while critical information is still conveyed, the logs remain manageable, and the system can gracefully handle transient or isolated relay issues without halting operation.

Highlights

  • Clarified Error Message: The vague 'received blocks parent is not his parent' error message has been replaced with a more descriptive 'block header chain mismatch' message, providing clearer context for network issues.
  • Reduced Log Spam: Startup block header chain mismatch warnings are now logged as a WARN only once. Subsequent occurrences of this specific error during startup will be logged at the DEBUG level to prevent excessive log spam.
  • Non-Fatal Mismatch Handling: The startup chain mismatch is now treated as non-fatal for the specific relay, allowing other relays to continue validating the network even if one encounters this issue.
Changelog
  • rpc/client.go
    • Added a new global variable startupBlockMismatchWarned to track if a startup block mismatch warning has already been issued.
    • Updated the error message for block header chain mismatches to be more explicit, changing it from a generic parent mismatch to 'block header chain mismatch at height %d: hash %s != next parent %s'.
    • Modified the Start method's error handling to specifically check for 'block header chain mismatch' errors. If detected, it logs a WARN message once and subsequent occurrences as DEBUG messages, and treats the error as non-fatal for the client.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request improves logging by clarifying a startup error message and reducing log spam, which is a welcome change. My review includes one suggestion to make the error handling more robust by using idiomatic Go error checking instead of relying on string matching, which will improve long-term maintainability.

Comment thread rpc/client.go
@dominicletz dominicletz merged commit e07e12e into master Feb 26, 2026
4 of 12 checks passed
@dominicletz dominicletz deleted the clean-startup-chain-mismatch-warnings branch February 26, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants