diff --git a/config.go b/config.go index dca79551f..be346c84a 100644 --- a/config.go +++ b/config.go @@ -629,6 +629,7 @@ func DefaultConfig() Config { Gossip: &lncfg.Gossip{ MaxChannelUpdateBurst: discovery.DefaultMaxChannelUpdateBurst, ChannelUpdateInterval: discovery.DefaultChannelUpdateInterval, + SubBatchDelay: discovery.DefaultSubBatchDelay, }, Invoices: &lncfg.Invoices{ HoldExpiryDelta: lncfg.DefaultHoldInvoiceExpiryDelta, diff --git a/discovery/gossiper.go b/discovery/gossiper.go index 7843b61e5..f00d18823 100644 --- a/discovery/gossiper.go +++ b/discovery/gossiper.go @@ -47,6 +47,10 @@ const ( // updates that we'll hold onto. maxPrematureUpdates = 100 + // DefaultSubBatchDelay is the default delay we'll use when + // broadcasting the next announcement batch. + DefaultSubBatchDelay = 5 * time.Second + // maxRejectedUpdates tracks the max amount of rejected channel updates // we'll maintain. This is the global size across all peers. We'll // allocate ~3 MB max to the cache. diff --git a/lncfg/gossip.go b/lncfg/gossip.go index 0eb3e7763..a2c82a7aa 100644 --- a/lncfg/gossip.go +++ b/lncfg/gossip.go @@ -16,6 +16,8 @@ type Gossip struct { MaxChannelUpdateBurst int `long:"max-channel-update-burst" description:"The maximum number of updates for a specific channel and direction that lnd will accept over the channel update interval."` ChannelUpdateInterval time.Duration `long:"channel-update-interval" description:"The interval used to determine how often lnd should allow a burst of new updates for a specific channel and direction."` + + SubBatchDelay time.Duration `long:"sub-batch-delay" description:"The duration to wait before sending the next announcement batch if there are multiple. Use a small value if there are a lot announcements and they need to be broadcast quickly."` } // Parse the pubkeys for the pinned syncers. diff --git a/lntemp/node/config.go b/lntemp/node/config.go index 0c228fef8..00b183354 100644 --- a/lntemp/node/config.go +++ b/lntemp/node/config.go @@ -187,6 +187,10 @@ func (cfg *BaseNodeConfig) GenArgs() []string { // Use a small batch window so we can broadcast our sweep // transactions faster. "--sweeper.batchwindowduration=5s", + + // Use a small batch delay so we can broadcast the + // announcements quickly in the tests. + "--gossip.sub-batch-delay=5ms", } args = append(args, nodeArgs...) diff --git a/sample-lnd.conf b/sample-lnd.conf index 96ac7e015..7d51b647d 100644 --- a/sample-lnd.conf +++ b/sample-lnd.conf @@ -1423,6 +1423,10 @@ litecoin.node=ltcd ; gossip.max-channel-update-burst=10 ; gossip.channel-update-interval=1m +; The duration to wait before sending the next announcement batch if there are +; multiple. Use a small value if there are a lot announcements and they need to +; be broadcast quickly. +; gossip.sub-batch-delay=5s [invoices] diff --git a/server.go b/server.go index d63d9644d..211955423 100644 --- a/server.go +++ b/server.go @@ -1013,7 +1013,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr, HistoricalSyncTicker: ticker.New(cfg.HistoricalSyncInterval), NumActiveSyncers: cfg.NumGraphSyncPeers, MinimumBatchSize: 10, - SubBatchDelay: time.Second * 5, + SubBatchDelay: cfg.Gossip.SubBatchDelay, IgnoreHistoricalFilters: cfg.IgnoreHistoricalGossipFilters, PinnedSyncers: cfg.Gossip.PinnedSyncers, MaxChannelUpdateBurst: cfg.Gossip.MaxChannelUpdateBurst,