mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-10 06:07:16 +01:00
multi: add new config peer-msg-rate-bytes
This commit is contained in:
@@ -407,6 +407,10 @@ type Config struct {
|
||||
// BanThreshold is the score used to decide whether a given peer is
|
||||
// banned or not.
|
||||
BanThreshold uint64
|
||||
|
||||
// PeerMsgRateBytes is the rate limit for the number of bytes per second
|
||||
// that we'll allocate to outbound gossip messages for a single peer.
|
||||
PeerMsgRateBytes uint64
|
||||
}
|
||||
|
||||
// processedNetworkMsg is a wrapper around networkMsg and a boolean. It is
|
||||
@@ -609,6 +613,7 @@ func New(cfg Config, selfKeyDesc *keychain.KeyDescriptor) *AuthenticatedGossiper
|
||||
AllotedMsgBytesPerSecond: cfg.MsgRateBytes,
|
||||
AllotedMsgBytesBurst: cfg.MsgBurstBytes,
|
||||
FilterConcurrency: cfg.FilterConcurrency,
|
||||
PeerMsgBytesPerSecond: cfg.PeerMsgRateBytes,
|
||||
})
|
||||
|
||||
gossiper.reliableSender = newReliableSender(&reliableSenderCfg{
|
||||
|
||||
@@ -146,6 +146,11 @@ type SyncManagerCfg struct {
|
||||
// FilterConcurrency is the maximum number of concurrent gossip filter
|
||||
// applications that can be processed. If not set, defaults to 5.
|
||||
FilterConcurrency int
|
||||
|
||||
// PeerMsgBytesPerSecond is the allotted bandwidth rate, expressed in
|
||||
// bytes/second that a single gossip syncer can consume. Once we exceed
|
||||
// this rate, message sending will block until we're below the rate.
|
||||
PeerMsgBytesPerSecond uint64
|
||||
}
|
||||
|
||||
// SyncManager is a subsystem of the gossiper that manages the gossip syncers
|
||||
@@ -674,6 +679,7 @@ func (m *SyncManager) createGossipSyncer(peer lnpeer.Peer) *GossipSyncer {
|
||||
maxQueryChanRangeReplies: maxQueryChanRangeReplies,
|
||||
noTimestampQueryOption: m.cfg.NoTimestampQueries,
|
||||
isStillZombieChannel: m.cfg.IsStillZombieChannel,
|
||||
msgBytesPerSecond: m.cfg.PeerMsgBytesPerSecond,
|
||||
}, m.gossipFilterSema)
|
||||
|
||||
// Gossip syncers are initialized by default in a PassiveSync type
|
||||
|
||||
Reference in New Issue
Block a user