Merge pull request #9875 from ziggie1984/fix-peer-connection-2

discovery: make sure we do not block the read queue
This commit is contained in:
Oliver Gugger authored and GitHub committed 2025-06-03 22:37:17 +02:00
commit 239aab8b9e
4 files changed
+31 -7

No files matched your search

-2
View File
@@ -860,8 +860,6 @@ func (d *AuthenticatedGossiper) stop() {
func (d *AuthenticatedGossiper) ProcessRemoteAnnouncement(ctx context.Context, func (d *AuthenticatedGossiper) ProcessRemoteAnnouncement(ctx context.Context,
msg lnwire.Message, peer lnpeer.Peer) chan error { 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) errChan := make(chan error, 1)
// For messages in the known set of channel series queries, we'll // For messages in the known set of channel series queries, we'll
+1 -1
View File
@@ -175,7 +175,7 @@ const (
requestBatchSize = 500 requestBatchSize = 500
// syncerBufferSize is the size of the syncer's buffers. // syncerBufferSize is the size of the syncer's buffers.
syncerBufferSize = 5 syncerBufferSize = 50
) )
var ( var (
+4 -1
View File
@@ -20,7 +20,7 @@
# Bug Fixes # 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 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. peer that has advertised an address that we do not yet know how to parse.
@@ -38,6 +38,9 @@
## Functional Enhancements ## Functional Enhancements
- [Increase](https://github.com/lightningnetwork/lnd/pull/9875) gossip sync
buffer to take the pressure of the read handler.
## RPC Additions ## RPC Additions
## lncli Additions ## lncli Additions
+26 -3
View File
@@ -1995,9 +1995,32 @@ func newDiscMsgStream(p *Brontide) *msgStream {
// so that a parent context can be passed in here. // so that a parent context can be passed in here.
ctx := context.TODO() ctx := context.TODO()
// TODO(yy): `ProcessRemoteAnnouncement` returns an error chan p.log.Debugf("Processing remote msg %T", msg)
// and we need to process it.
p.cfg.AuthGossiper.ProcessRemoteAnnouncement(ctx, msg, p) 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( return newMsgStream(