From 07a9a9b8c9de64ad6be0de28733f3ad6dc30bac4 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 23 Mar 2022 23:22:25 +0000 Subject: [PATCH] Reduce the max pending forwarded gossip messages somewhat There's no reason to forward more gossip messages than we include in the pending buffer during initial sync. Forwarding is a best-effort action and we don't care too much if we have to drop messages because we're receiving too many gossip messages, in fact that's the desired otucome. Initial gossip, on the other hand, we want to be as liberal as we can be, as we are effectively rate-limited to our messages-per-ping messages per our network RTT, which can lead to initial sync being rather slow. --- lightning/src/ln/peer_handler.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index d12f8c06e..8104c61d3 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -1236,7 +1236,7 @@ impl P continue } if peer.pending_outbound_buffer.len() > OUTBOUND_BUFFER_LIMIT_DROP_GOSSIP - || peer.msgs_sent_since_pong > BUFFER_DRAIN_MSGS_PER_TICK * FORWARD_INIT_SYNC_BUFFER_LIMIT_RATIO + || peer.msgs_sent_since_pong > BUFFER_DRAIN_MSGS_PER_TICK { log_gossip!(self.logger, "Skipping broadcast message to {:?} as its outbound buffer is full", peer.their_node_id); continue; @@ -1261,7 +1261,7 @@ impl P continue } if peer.pending_outbound_buffer.len() > OUTBOUND_BUFFER_LIMIT_DROP_GOSSIP - || peer.msgs_sent_since_pong > BUFFER_DRAIN_MSGS_PER_TICK * FORWARD_INIT_SYNC_BUFFER_LIMIT_RATIO + || peer.msgs_sent_since_pong > BUFFER_DRAIN_MSGS_PER_TICK { log_gossip!(self.logger, "Skipping broadcast message to {:?} as its outbound buffer is full", peer.their_node_id); continue; @@ -1285,7 +1285,7 @@ impl P continue } if peer.pending_outbound_buffer.len() > OUTBOUND_BUFFER_LIMIT_DROP_GOSSIP - || peer.msgs_sent_since_pong > BUFFER_DRAIN_MSGS_PER_TICK * FORWARD_INIT_SYNC_BUFFER_LIMIT_RATIO + || peer.msgs_sent_since_pong > BUFFER_DRAIN_MSGS_PER_TICK { log_gossip!(self.logger, "Skipping broadcast message to {:?} as its outbound buffer is full", peer.their_node_id); continue; -- 2.39.5