From a6abb3c960d627d231ab70c9dea8d7caacdc3b78 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Fri, 24 Feb 2023 04:23:41 +0800 Subject: [PATCH] discovery: increase allowed max future message size This commit adds a new const to increase the max future messages allowed from 100 to 1000, which is needed as during IBD a node with lots of channels might receive many future messages. --- discovery/gossiper.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/discovery/gossiper.go b/discovery/gossiper.go index 96f6b0755..f77390387 100644 --- a/discovery/gossiper.go +++ b/discovery/gossiper.go @@ -47,6 +47,10 @@ const ( // updates that we'll hold onto. maxPrematureUpdates = 100 + // maxFutureMessages tracks the max amount of future messages that + // we'll hold onto. + maxFutureMessages = 1000 + // DefaultSubBatchDelay is the default delay we'll use when // broadcasting the next announcement batch. DefaultSubBatchDelay = 5 * time.Second @@ -483,7 +487,7 @@ func New(cfg Config, selfKeyDesc *keychain.KeyDescriptor) *AuthenticatedGossiper cfg: &cfg, networkMsgs: make(chan *networkMsg), futureMsgs: lru.NewCache[uint32, *cachedNetworkMsg]( - maxPrematureUpdates, + maxFutureMessages, ), quit: make(chan struct{}), chanPolicyUpdates: make(chan *chanPolicyUpdateRequest),