feat: remove default gossip peers#2090
feat: remove default gossip peers#2090Anshumancanrock wants to merge 1 commit intogetAlby:masterfrom
Conversation
📝 WalkthroughWalkthroughRemoved the background P2P gossip connection routine from the LDK client's Bitcoin network initialization, eliminating the goroutine that established connections to hard-coded LSP peers and associated connection handling logic. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
lnclient/ldk/ldk.go (1)
185-192: LGTM — logic is correct.The fallback only activates on
network == "bitcoin"(thenetworkstring variable is never mutated by theswitchbelow), so mainnet gets the default RGS URL and all other networks are unaffected.Two minor suggestions:
Log field naming:
"gossipSource"uses camelCase, while every other log field in this file usessnake_case(e.g."rpc_host","chain_source","node_alias").Inline string constant: The hardcoded RGS URL could be a named constant to make it more discoverable if it ever needs to change.
♻️ Proposed refinements
+const defaultMainnetRgsSource = "https://rapidsync.lightningdevkit.org/snapshot" + const resetRouterKey = "ResetRouter"gossipSource := cfg.GetEnv().LDKGossipSource if gossipSource == "" && network == "bitcoin" { - gossipSource = "https://rapidsync.lightningdevkit.org/snapshot" + gossipSource = defaultMainnetRgsSource } if gossipSource != "" { - logger.Logger.WithField("gossipSource", gossipSource).Info("LDK RGS instance set") + logger.Logger.WithField("gossip_source", gossipSource).Info("LDK RGS instance set") builder.SetGossipSourceRgs(gossipSource) }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lnclient/ldk/ldk.go` around lines 185 - 192, The log field uses camelCase and the RGS URL is inline; change the log field key passed to logger.Logger.WithField from "gossipSource" to snake_case "gossip_source" and replace the hardcoded URL string used when gossipSource is empty with a named constant (e.g., defaultRGSURL) defined near the top of this package/file; update the code paths that reference gossipSource and builder.SetGossipSourceRgs(gossipSource) to use the new constant when appropriate so behavior is unchanged but the URL is discoverable and logs follow the existing snake_case convention.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@lnclient/ldk/ldk.go`:
- Around line 185-192: The log field uses camelCase and the RGS URL is inline;
change the log field key passed to logger.Logger.WithField from "gossipSource"
to snake_case "gossip_source" and replace the hardcoded URL string used when
gossipSource is empty with a named constant (e.g., defaultRGSURL) defined near
the top of this package/file; update the code paths that reference gossipSource
and builder.SetGossipSourceRgs(gossipSource) to use the new constant when
appropriate so behavior is unchanged but the URL is discoverable and logs follow
the existing snake_case convention.
|
hi @rolznz , Removed the hardcoded gossip peers and defaulted mainnet to RGS when |
|
Hi, thanks for the PR. In the issue there is no mention/request to change the RGS configuration. |
6914592 to
ea97a2b
Compare
|
Hi @rolznz , You're right that's a separate concern from what the issue asked for. I've updated the PR to only remove the hardcoded gossip peers as the issue requested. Please review it and let me know if any changes are needed. Thanks ! |
Fixes: #2083
Removes the default gossip peers for the LDK backend. These peers were putting unnecessary stress on LSPs by peering without necessarily opening a channel.
Changes