Merge pull request #4353 from LN-Zap/feat/neutrino-user-agent

Ability to configure neutrino useragent
This commit is contained in:
Conner Fromknecht 2020-09-23 16:45:19 -07:00 committed by GitHub
commit e135047304
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 0 deletions

@ -803,6 +803,8 @@ func initNeutrinoBackend(cfg *Config, chainDir string) (*neutrino.ChainService,
neutrino.MaxPeers = 8 neutrino.MaxPeers = 8
neutrino.BanDuration = time.Hour * 48 neutrino.BanDuration = time.Hour * 48
neutrino.UserAgentName = cfg.NeutrinoMode.UserAgentName
neutrino.UserAgentVersion = cfg.NeutrinoMode.UserAgentVersion
neutrinoCS, err := neutrino.NewChainService(config) neutrinoCS, err := neutrino.NewChainService(config)
if err != nil { if err != nil {

@ -20,6 +20,7 @@ import (
"github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil"
flags "github.com/jessevdk/go-flags" flags "github.com/jessevdk/go-flags"
"github.com/lightninglabs/neutrino"
"github.com/lightningnetwork/lnd/autopilot" "github.com/lightningnetwork/lnd/autopilot"
"github.com/lightningnetwork/lnd/build" "github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/chanbackup" "github.com/lightningnetwork/lnd/chanbackup"
@ -372,6 +373,10 @@ func DefaultConfig() Config {
RPCHost: defaultRPCHost, RPCHost: defaultRPCHost,
EstimateMode: defaultBitcoindEstimateMode, EstimateMode: defaultBitcoindEstimateMode,
}, },
NeutrinoMode: &lncfg.Neutrino{
UserAgentName: neutrino.UserAgentName,
UserAgentVersion: neutrino.UserAgentVersion,
},
UnsafeDisconnect: true, UnsafeDisconnect: true,
MaxPendingChannels: lncfg.DefaultMaxPendingChannels, MaxPendingChannels: lncfg.DefaultMaxPendingChannels,
NoSeedBackup: defaultNoSeedBackup, NoSeedBackup: defaultNoSeedBackup,

@ -211,6 +211,8 @@ neutrino:
--neutrino.maxpeers= Max number of inbound and outbound peers --neutrino.maxpeers= Max number of inbound and outbound peers
--neutrino.banduration= How long to ban misbehaving peers. Valid time units are {s, m, h}. Minimum 1 second --neutrino.banduration= How long to ban misbehaving peers. Valid time units are {s, m, h}. Minimum 1 second
--neutrino.banthreshold= Maximum allowed ban score before disconnecting and banning misbehaving peers. --neutrino.banthreshold= Maximum allowed ban score before disconnecting and banning misbehaving peers.
--neutrino.useragentname= Used to help identify ourselves to other bitcoin peers.
--neutrino.useragentversion= Used to help identify ourselves to other bitcoin peers.
``` ```
## Bitcoind Options ## Bitcoind Options

@ -12,4 +12,6 @@ type Neutrino struct {
BanThreshold uint32 `long:"banthreshold" description:"Maximum allowed ban score before disconnecting and banning misbehaving peers."` BanThreshold uint32 `long:"banthreshold" description:"Maximum allowed ban score before disconnecting and banning misbehaving peers."`
FeeURL string `long:"feeurl" description:"DEPRECATED: Optional URL for fee estimation. If a URL is not specified, static fees will be used for estimation."` FeeURL string `long:"feeurl" description:"DEPRECATED: Optional URL for fee estimation. If a URL is not specified, static fees will be used for estimation."`
AssertFilterHeader string `long:"assertfilterheader" description:"Optional filter header in height:hash format to assert the state of neutrino's filter header chain on startup. If the assertion does not hold, then the filter header chain will be re-synced from the genesis block."` AssertFilterHeader string `long:"assertfilterheader" description:"Optional filter header in height:hash format to assert the state of neutrino's filter header chain on startup. If the assertion does not hold, then the filter header chain will be re-synced from the genesis block."`
UserAgentName string `long:"useragentname" description:"Used to help identify ourselves to other bitcoin peers"`
UserAgentVersion string `long:"useragentversion" description:"Used to help identify ourselves to other bitcoin peers"`
} }