Skip to content

Commit de1ed93

Browse files
authored
Merge pull request #9601 from bitromortac/2503-neutrino-maxpeers
lnd: pass through neutrino MaxPeers config
2 parents c292acf + a93ec3b commit de1ed93

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

config.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ const (
248248
bitcoindBackendName = "bitcoind"
249249
btcdBackendName = "btcd"
250250
neutrinoBackendName = "neutrino"
251+
252+
defaultPrunedNodeMaxPeers = 4
253+
defaultNeutrinoMaxPeers = 8
251254
)
252255

253256
var (
@@ -285,8 +288,6 @@ var (
285288
// estimatesmartfee RPC call.
286289
defaultBitcoindEstimateMode = "CONSERVATIVE"
287290
bitcoindEstimateModes = [2]string{"ECONOMICAL", defaultBitcoindEstimateMode}
288-
289-
defaultPrunedNodeMaxPeers = 4
290291
)
291292

292293
// Config defines the configuration options for lnd.
@@ -599,6 +600,7 @@ func DefaultConfig() Config {
599600
NeutrinoMode: &lncfg.Neutrino{
600601
UserAgentName: neutrino.UserAgentName,
601602
UserAgentVersion: neutrino.UserAgentVersion,
603+
MaxPeers: defaultNeutrinoMaxPeers,
602604
},
603605
BlockCacheSize: defaultBlockCacheSize,
604606
MaxPendingChannels: lncfg.DefaultMaxPendingChannels,

config_builder.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,11 @@ func initNeutrinoBackend(ctx context.Context, cfg *Config, chainDir string,
15281528
PersistToDisk: cfg.NeutrinoMode.PersistFilters,
15291529
}
15301530

1531-
neutrino.MaxPeers = 8
1531+
if cfg.NeutrinoMode.MaxPeers <= 0 {
1532+
return nil, nil, fmt.Errorf("a non-zero number must be set " +
1533+
"for neutrino max peers")
1534+
}
1535+
neutrino.MaxPeers = cfg.NeutrinoMode.MaxPeers
15321536
neutrino.BanDuration = time.Hour * 48
15331537
neutrino.UserAgentName = cfg.NeutrinoMode.UserAgentName
15341538
neutrino.UserAgentVersion = cfg.NeutrinoMode.UserAgentVersion

docs/release-notes/release-notes-0.19.0.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@
8888
* [The aux bandwidth calculation was fixed for non-asset
8989
channels](https://github.com/lightningnetwork/lnd/pull/9502).
9090

91+
* [Pass through](https://github.com/lightningnetwork/lnd/pull/9601) the unused
92+
`MaxPeers` configuration variable for neutrino mode.
93+
9194
# New Features
9295

9396
* [Support](https://github.com/lightningnetwork/lnd/pull/8390) for
@@ -419,6 +422,7 @@ The underlying functionality between those two options remain the same.
419422
* Abdullahi Yunus
420423
* Andras Banki-Horvath
421424
* Animesh Bilthare
425+
* bitromortac
422426
* Boris Nagaev
423427
* Carla Kirk-Cohen
424428
* CharlieZKSmith

sample-lnd.conf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -840,9 +840,7 @@
840840
; neutrino.connect=
841841

842842
; Max number of inbound and outbound peers.
843-
;
844-
; NOTE: This value is currently unused.
845-
; neutrino.maxpeers=
843+
; neutrino.maxpeers=8
846844

847845
; Add a peer to connect with at startup.
848846
; neutrino.addpeer=

0 commit comments

Comments
 (0)