]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Reduce the max pending forwarded gossip messages somewhat 2022-03-less-gossip-forward
authorMatt Corallo <git@bluematt.me>
Wed, 23 Mar 2022 23:22:25 +0000 (23:22 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 23 Mar 2022 23:28:47 +0000 (23:28 +0000)
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

index d12f8c06eed0409630864359e54c20d3b714930d..8104c61d30b64bb26cebada787221eb81b706668 100644 (file)
@@ -1236,7 +1236,7 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> 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<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> 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<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> 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;