From 74c55411473ec365f53edf9bc0054fc67d034d73 Mon Sep 17 00:00:00 2001 From: ziggie Date: Wed, 28 May 2025 13:45:32 +0200 Subject: [PATCH 1/3] brontide: increase logging when processing gossip msgs We add logging to we can draw conclusions how long the processing of gossip message last and potentially see whether the syncer buffer channel size is a bottleneck in processing. --- discovery/gossiper.go | 2 -- peer/brontide.go | 29 ++++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/discovery/gossiper.go b/discovery/gossiper.go index 4b2f4f220..0b59c8af9 100644 --- a/discovery/gossiper.go +++ b/discovery/gossiper.go @@ -860,8 +860,6 @@ func (d *AuthenticatedGossiper) stop() { func (d *AuthenticatedGossiper) ProcessRemoteAnnouncement(ctx context.Context, msg lnwire.Message, peer lnpeer.Peer) chan error { - log.Debugf("Processing remote msg %T from peer=%x", msg, peer.PubKey()) - errChan := make(chan error, 1) // For messages in the known set of channel series queries, we'll diff --git a/peer/brontide.go b/peer/brontide.go index cd7645aee..26d02d3e7 100644 --- a/peer/brontide.go +++ b/peer/brontide.go @@ -1995,9 +1995,32 @@ func newDiscMsgStream(p *Brontide) *msgStream { // so that a parent context can be passed in here. ctx := context.TODO() - // TODO(yy): `ProcessRemoteAnnouncement` returns an error chan - // and we need to process it. - p.cfg.AuthGossiper.ProcessRemoteAnnouncement(ctx, msg, p) + p.log.Debugf("Processing remote msg %T", msg) + + errChan := p.cfg.AuthGossiper.ProcessRemoteAnnouncement( + ctx, msg, p, + ) + + // Start a goroutine to process the error channel for logging + // purposes. + // + // TODO(ziggie): Maybe use the error to potentially punish the + // peer depending on the error ? + go func() { + select { + case <-p.cg.Done(): + return + + case err := <-errChan: + if err != nil { + p.log.Warnf("Error processing remote "+ + "msg %T: %v", msg, + err) + } + } + + p.log.Debugf("Processed remote msg %T", msg) + }() } return newMsgStream( From 732d3a77b4bcc369751ad0890f975be1067b61f2 Mon Sep 17 00:00:00 2001 From: ziggie Date: Wed, 28 May 2025 13:49:50 +0200 Subject: [PATCH 2/3] discovery: increase syncer gossip chan buffer --- discovery/syncer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discovery/syncer.go b/discovery/syncer.go index b27cc8c71..ccea2dc29 100644 --- a/discovery/syncer.go +++ b/discovery/syncer.go @@ -175,7 +175,7 @@ const ( requestBatchSize = 500 // syncerBufferSize is the size of the syncer's buffers. - syncerBufferSize = 5 + syncerBufferSize = 50 ) var ( From 6f45735d5508b3e0da3740bd88eebc296d6c0276 Mon Sep 17 00:00:00 2001 From: ziggie Date: Tue, 3 Jun 2025 21:18:19 +0200 Subject: [PATCH 3/3] docs: add release notes for 19.1 --- docs/release-notes/release-notes-0.19.1.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/release-notes-0.19.1.md b/docs/release-notes/release-notes-0.19.1.md index 47c1706ce..656d6b559 100644 --- a/docs/release-notes/release-notes-0.19.1.md +++ b/docs/release-notes/release-notes-0.19.1.md @@ -20,7 +20,7 @@ # Bug Fixes -* [Fix a serialisation bug](https://github.com/lightningnetwork/lnd/pull/9856) +- [Fix a serialisation bug](https://github.com/lightningnetwork/lnd/pull/9856) that would occur when an attempt was made to write a backup file for a channel peer that has advertised an address that we do not yet know how to parse. @@ -38,6 +38,9 @@ ## Functional Enhancements +- [Increase](https://github.com/lightningnetwork/lnd/pull/9875) gossip sync + buffer to take the pressure of the read handler. + ## RPC Additions ## lncli Additions