From: Matt Corallo Date: Wed, 23 Mar 2022 23:22:25 +0000 (+0000) Subject: Reduce the max pending forwarded gossip messages somewhat X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=refs%2Fheads%2F2022-03-less-gossip-forward;p=rust-lightning 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. --- 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;