Skip to content

Commit e496c9b

Browse files
committed
Constify the ratio in buf limits between forward and init sync msgs
1 parent 4a58e9a commit e496c9b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lightning/src/ln/peer_handler.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,18 @@ enum InitSyncTracker{
285285
NodesSyncing(PublicKey),
286286
}
287287

288+
/// The ratio between buffer sizes at which we stop sending initial sync messages vs when we stop
289+
/// forwarding gossip messages to peers altogether.
290+
const FORWARD_INIT_SYNC_BUFFER_LIMIT_RATIO: usize = 2;
291+
288292
/// When the outbound buffer has this many messages, we'll stop reading bytes from the peer until
289293
/// we have fewer than this many messages in the outbound buffer again.
290294
/// We also use this as the target number of outbound gossip messages to keep in the write buffer,
291295
/// refilled as we send bytes.
292296
const OUTBOUND_BUFFER_LIMIT_READ_PAUSE: usize = 10;
293297
/// When the outbound buffer has this many messages, we'll simply skip relaying gossip messages to
294298
/// the peer.
295-
const OUTBOUND_BUFFER_LIMIT_DROP_GOSSIP: usize = 20;
299+
const OUTBOUND_BUFFER_LIMIT_DROP_GOSSIP: usize = OUTBOUND_BUFFER_LIMIT_READ_PAUSE * FORWARD_INIT_SYNC_BUFFER_LIMIT_RATIO;
296300

297301
struct Peer {
298302
channel_encryptor: PeerChannelEncryptor,

0 commit comments

Comments
 (0)