Skip to content

Conversation

@ellemouton
Copy link
Collaborator

@ellemouton ellemouton commented Oct 2, 2025

Here we:

  • move the definition of the GossipVersion from the db package to the lnwire package.
  • we also add a GossipMessage interface which all the gossip messages implement. This allows us to query the protocol that the message was gossiped on.
  • we make our first use of this new interface in the discovery package in the rejectCache

@ellemouton ellemouton self-assigned this Oct 2, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @ellemouton, 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 introduces foundational changes to support multiple gossip protocol versions, specifically in preparation for the G175 update. It centralizes the definition of gossip protocol versions within the lnwire package and establishes a new GossipMessage interface. This interface is now implemented by all core gossip messages, enabling the system to differentiate and handle messages based on their protocol version. The discovery package's reject cache and the graph/db package's storage mechanisms have been updated to leverage this new versioning, ensuring proper segregation and processing of gossip data across different protocol iterations.

Highlights

  • Gossip Version Centralization: The GossipVersion type and its associated constants (GossipVersion1, GossipVersion2) have been moved from the graph/db package to the lnwire package, centralizing the definition of gossip protocol versions.
  • New GossipMessage Interface: A new GossipMessage interface has been introduced in lnwire, which includes a GossipVersion() method. All relevant gossip messages (AnnounceSignatures, ChannelAnnouncement, ChannelUpdate, NodeAnnouncement) now implement this interface, allowing for easy querying of the protocol version.
  • Version-Aware Reject Cache: The rejectCache in the discovery package has been updated to include the GossipVersion in its keys. This ensures that rejected messages are distinguished by their protocol version, preventing a message rejected for one version from blocking a valid message for another.
  • NodeAnnouncement Interface: A new NodeAnnouncement interface has been added to lnwire, and both NodeAnnouncement1 and NodeAnnouncement2 now implement it, along with the GossipMessage interface.
  • Database Integration: All references to ProtocolV1 within the graph/db package (including migrations and the SQLStore) have been updated to use the new lnwire.GossipVersion1 constant, aligning the database layer with the centralized versioning.
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

@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 is a great step towards supporting G175. Moving GossipVersion to the lnwire package and introducing the GossipMessage interface are clean refactorings that will make it easier to handle multiple gossip protocol versions. The changes are applied consistently across the codebase. I have one suggestion to further improve the implementation in the discovery package to make it more robust for future protocol versions.

@saubyk saubyk added this to v0.21 Oct 2, 2025
@saubyk saubyk moved this to In progress in v0.21 Oct 2, 2025
@saubyk saubyk added this to the v0.21.0 milestone Oct 2, 2025
Copy link
Collaborator

@bhandras bhandras left a comment

Choose a reason for hiding this comment

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

LGTM 🎉🎉

Copy link
Collaborator

@bitromortac bitromortac left a comment

Choose a reason for hiding this comment

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

LGTM ⚡

@ellemouton ellemouton changed the base branch from master to 0-21-0-staging October 8, 2025 07:53
And ensure that both versions 1 and 2 implement it.
Define a GossipVersion enum along with a GossipMessage interface to be
satisfied by all gossip related messages. This will be useful later on
when we want to make decisions based on the protocol version that a
message is part of.
Since the gossip protocols are completely disjoint, we need to treat
messages on the two protocols completely separately and should not let
rejections on one protocol affect how we treat messages on the other.
@ellemouton ellemouton merged commit 30decfc into lightningnetwork:0-21-0-staging Oct 8, 2025
39 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in v0.21 Oct 8, 2025
@ellemouton ellemouton deleted the g175Prep branch October 8, 2025 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants