lnd: pass through neutrino MaxPeers config

This enables users to set the config. We check that the currently set
value of MaxPeers is non-zero.
This commit is contained in:
bitromortac committed 2025-03-18 17:55:20 +01:00
1 parent c292acfe74
commit a93ec3b01a
4 files changed
+14 -6

No files matched your search

+5 -1
View File
@@ -1528,7 +1528,11 @@ func initNeutrinoBackend(ctx context.Context, cfg *Config, chainDir string,
PersistToDisk: cfg.NeutrinoMode.PersistFilters,
}
neutrino.MaxPeers = 8
if cfg.NeutrinoMode.MaxPeers <= 0 {
return nil, nil, fmt.Errorf("a non-zero number must be set " +
"for neutrino max peers")
}
neutrino.MaxPeers = cfg.NeutrinoMode.MaxPeers
neutrino.BanDuration = time.Hour * 48
neutrino.UserAgentName = cfg.NeutrinoMode.UserAgentName
neutrino.UserAgentVersion = cfg.NeutrinoMode.UserAgentVersion