mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-02 03:22:25 +02:00
multi: add new config options to tune gossip msg allocated bandwidth
We go with the defaults of if no values are set.
This commit is contained in:
@ -707,6 +707,8 @@ func DefaultConfig() Config {
|
||||
ChannelUpdateInterval: discovery.DefaultChannelUpdateInterval,
|
||||
SubBatchDelay: discovery.DefaultSubBatchDelay,
|
||||
AnnouncementConf: discovery.DefaultProofMatureDelta,
|
||||
MsgRateBytes: discovery.DefaultMsgBytesPerSecond,
|
||||
MsgBurstBytes: discovery.DefaultMsgBytesBurst,
|
||||
},
|
||||
Invoices: &lncfg.Invoices{
|
||||
HoldExpiryDelta: lncfg.DefaultHoldInvoiceExpiryDelta,
|
||||
|
@ -390,6 +390,14 @@ type Config struct {
|
||||
// spent-ness of channel outpoints. For neutrino, this saves long
|
||||
// rescans from blocking initial usage of the daemon.
|
||||
AssumeChannelValid bool
|
||||
|
||||
// MsgRateBytes is the rate limit for the number of bytes per second
|
||||
// that we'll allocate to outbound gossip messages.
|
||||
MsgRateBytes uint64
|
||||
|
||||
// MsgBurstBytes is the allotted burst amount in bytes. This is the
|
||||
// number of starting tokens in our token bucket algorithm.
|
||||
MsgBurstBytes uint64
|
||||
}
|
||||
|
||||
// processedNetworkMsg is a wrapper around networkMsg and a boolean. It is
|
||||
@ -584,6 +592,8 @@ func New(cfg Config, selfKeyDesc *keychain.KeyDescriptor) *AuthenticatedGossiper
|
||||
BestHeight: gossiper.latestHeight,
|
||||
PinnedSyncers: cfg.PinnedSyncers,
|
||||
IsStillZombieChannel: cfg.IsStillZombieChannel,
|
||||
AllotedMsgBytesPerSecond: cfg.MsgRateBytes,
|
||||
AllotedMsgBytesBurst: cfg.MsgBurstBytes,
|
||||
})
|
||||
|
||||
gossiper.reliableSender = newReliableSender(&reliableSenderCfg{
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/lightningnetwork/lnd/discovery"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/routing/route"
|
||||
)
|
||||
|
||||
@ -32,6 +33,10 @@ type Gossip struct {
|
||||
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."`
|
||||
|
||||
AnnouncementConf uint32 `long:"announcement-conf" description:"The number of confirmations required before processing channel announcements."`
|
||||
|
||||
MsgRateBytes uint64 `long:"msg-rate-bytes" description:"The maximum number of bytes of gossip messages that will be sent per second. This is a global limit that applies to all peers."`
|
||||
|
||||
MsgBurstBytes uint64 `long:"msg-burst-bytes" description:"The maximum number of bytes of gossip messages that will be sent in a burst. This is a global limit that applies to all peers. This value should be set to something greater than 130 KB"`
|
||||
}
|
||||
|
||||
// Parse the pubkeys for the pinned syncers.
|
||||
@ -58,6 +63,11 @@ func (g *Gossip) Validate() error {
|
||||
"%v", g.AnnouncementConf, minAnnouncementConf)
|
||||
}
|
||||
|
||||
if g.MsgBurstBytes < lnwire.MaxSliceLength {
|
||||
return fmt.Errorf("msg-burst-bytes=%v must be at least %v",
|
||||
g.MsgBurstBytes, lnwire.MaxSliceLength)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -1746,6 +1746,17 @@
|
||||
; The number of confirmations required before processing channel announcements.
|
||||
; gossip.announcement-conf=6
|
||||
|
||||
; The allotted bandwidth rate expressed in bytes/second that will be allocated
|
||||
; towards outbound gossip messages. Realized rates above this value will be
|
||||
; throttled. This value is shared across all peers.
|
||||
; gossip.msg-rate-bytes=102400
|
||||
|
||||
; The amount of bytes of gossip messages that can be sent at a given time. This
|
||||
; is used as the amount of tokens in the token bucket algorithm. This value
|
||||
; MUST be set to something about 65 KB, otherwise a single max sized message
|
||||
; can never be sent.
|
||||
; gossip.msg-burst-bytes=204800
|
||||
|
||||
[invoices]
|
||||
|
||||
; If a hold invoice has accepted htlcs that reach their expiry height and are
|
||||
|
@ -1188,6 +1188,8 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
||||
IsStillZombieChannel: s.graphBuilder.IsZombieChannel,
|
||||
ScidCloser: scidCloserMan,
|
||||
AssumeChannelValid: cfg.Routing.AssumeChannelValid,
|
||||
MsgRateBytes: cfg.Gossip.MsgRateBytes,
|
||||
MsgBurstBytes: cfg.Gossip.MsgBurstBytes,
|
||||
}, nodeKeyDesc)
|
||||
|
||||
accessCfg := &accessManConfig{
|
||||
|
Reference in New Issue
Block a user