Skip to content

Conversation

@yyforyongyu
Copy link
Member

When replying to gossip_timestamp_filter, we will send ChannelAnnouncement, NodeAnnouncement and two ChannelUpdate1s. And their sizes are,

  • ChannelAnnouncement1: This message has a mostly fixed size.

    • Fixed size fields: 428 bytes (signatures, chain hash, short channel ID, node IDs, and bitcoin keys).
    • Variable size fields: A feature vector (minimum 2 bytes) and extra opaque data.
    • Minimum payload size: 430 bytes
  • NodeAnnouncement: This message has both fixed and variable size components.

    • Fixed size fields: 136 bytes (signature, timestamp, node ID, color, and alias).
    • Variable size fields: A feature vector (minimum 2 bytes) and a list of network addresses (minimum 2 bytes for an empty list).
    • Minimum payload size: 140 bytes
  • ChannelUpdate1: This message has a mostly fixed size.

    • Fixed size fields: 128 bytes (signature, chain hash, short channel ID, timestamp, flags, fee information, and HtlcMaximumMsat).
    • Minimum payload size: 136 bytes

Best case: Assuming the minimal sizes, we will send 430+140+136*2 = 842 bytes per channel, with the current default of 100kb, we can process 121 channels per second.

Worst case: Assuming max size, when all the msgs are using extra bytes, we will send 65535*4 = 262,140 bytes per channel, and with the current default, we can process 6 channels per second. But this is highly unlikely.

Note that this value is shared among all peers, which means if we have 10 peers, we can only process 12 channels per peer per second.

@yyforyongyu yyforyongyu added gossip size/micro small bug fix or feature, less than 15 mins of review, less than 250 labels Jul 21, 2025
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.

Summary of Changes

Hello @yyforyongyu, 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 significantly increases the default outgoing gossip bandwidth limits within the system. The primary goal is to improve the efficiency and speed at which the node can propagate critical network information, such as channel and node announcements, especially when responding to gossip requests. This change aims to alleviate potential bottlenecks in network synchronization and message dissemination.

Highlights

  • Increased Outgoing Gossip Bandwidth: The default values for DefaultMsgBytesBurst and DefaultMsgBytesPerSecond have been increased tenfold, from 100KB/s to 1MB/s for the rate, and from 200KB to 2MB for the burst. This significantly boosts the capacity for sending gossip messages.
  • Improved Configuration Documentation: The descriptions for the MsgRateBytes and MsgBurstBytes configuration options in lncfg/gossip.go and sample-lnd.conf have been updated to provide clearer and more detailed explanations of their purpose and interaction within the token bucket rate-limiting scheme.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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.

@gemini-code-assist
Copy link

Warning

Gemini is unable to generate a review due to a potential policy violation.

// this, will block indefinitely. Once tokens (bytes are depleted),
// they'll be refilled at the DefaultMsgBytesPerSecond rate.
DefaultMsgBytesBurst = 2 * 100 * 1_024
DefaultMsgBytesBurst = 2 * 1000 * 1_024
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to also increase this?

Copy link
Member Author

Choose a reason for hiding this comment

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

the burst must be greater than the msg-rate-bytes otherwise msg-rate-bytes may not take effect, more details here.

@yyforyongyu yyforyongyu force-pushed the increase-gossip-default branch from 6fef5b6 to d0c07d7 Compare July 25, 2025 09:45
Copy link
Collaborator

@morehouse morehouse left a comment

Choose a reason for hiding this comment

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

I think 1 MB/s is a reasonable default outgoing rate limit. At least in the US, typical upload speeds are higher than this.

Lower-end setups may want to rate limit more aggressively.

@Roasbeef Roasbeef modified the milestones: v0.20.0, v0.19.3 Jul 25, 2025
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 🏊‍♀️

@Roasbeef Roasbeef merged commit 2e36f9b into lightningnetwork:master Jul 25, 2025
39 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in lnd v0.20 Jul 25, 2025
@saubyk saubyk removed this from lnd v0.20 Jul 28, 2025
@yyforyongyu yyforyongyu deleted the increase-gossip-default branch July 31, 2025 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gossip size/micro small bug fix or feature, less than 15 mins of review, less than 250

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants