Merge pull request #5193 from wpaulino/neutrino-assume-valid
Use routing.assumechanvalid=true by default in Neutrino mode
This commit is contained in:
commit
25dfbc4106
@ -14,4 +14,5 @@ type Neutrino struct {
|
|||||||
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"`
|
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"`
|
UserAgentVersion string `long:"useragentversion" description:"Used to help identify ourselves to other bitcoin peers"`
|
||||||
|
ValidateChannels bool `long:"validatechannels" description:"Validate every channel in the graph during sync by downloading the containing block. This is the inverse of routing.assumechanvalid, meaning that for Neutrino the validation is turned off by default for massively increased graph sync performance. This speedup comes at the risk of using an unvalidated view of the network for routing. Overwrites the value of routing.assumechanvalid if Neutrino is used. (default: false)"`
|
||||||
}
|
}
|
||||||
|
@ -2,5 +2,5 @@ package lncfg
|
|||||||
|
|
||||||
// Routing holds the configuration options for routing.
|
// Routing holds the configuration options for routing.
|
||||||
type Routing struct {
|
type Routing struct {
|
||||||
AssumeChannelValid bool `long:"assumechanvalid" description:"Skip checking channel spentness during graph validation. This speedup comes at the risk of using an unvalidated view of the network for routing. (default: false)"`
|
AssumeChannelValid bool `long:"assumechanvalid" description:"DEPRECATED: This is now turned on by default for Neutrino (use neutrino.validatechannels=true to turn off) and shouldn't be used for any other backend! (default: false)"`
|
||||||
}
|
}
|
||||||
|
11
lnd.go
11
lnd.go
@ -1553,6 +1553,17 @@ func initializeDatabases(ctx context.Context,
|
|||||||
func initNeutrinoBackend(cfg *Config, chainDir string) (*neutrino.ChainService,
|
func initNeutrinoBackend(cfg *Config, chainDir string) (*neutrino.ChainService,
|
||||||
func(), error) {
|
func(), error) {
|
||||||
|
|
||||||
|
// Both channel validation flags are false by default but their meaning
|
||||||
|
// is the inverse of each other. Therefore both cannot be true. For
|
||||||
|
// every other case, the neutrino.validatechannels overwrites the
|
||||||
|
// routing.assumechanvalid value.
|
||||||
|
if cfg.NeutrinoMode.ValidateChannels && cfg.Routing.AssumeChannelValid {
|
||||||
|
return nil, nil, fmt.Errorf("can't set both " +
|
||||||
|
"neutrino.validatechannels and routing." +
|
||||||
|
"assumechanvalid to true at the same time")
|
||||||
|
}
|
||||||
|
cfg.Routing.AssumeChannelValid = !cfg.NeutrinoMode.ValidateChannels
|
||||||
|
|
||||||
// First we'll open the database file for neutrino, creating the
|
// First we'll open the database file for neutrino, creating the
|
||||||
// database if needed. We append the normalized network name here to
|
// database if needed. We append the normalized network name here to
|
||||||
// match the behavior of btcwallet.
|
// match the behavior of btcwallet.
|
||||||
|
@ -24,6 +24,9 @@ func (b NeutrinoBackendConfig) GenArgs() []string {
|
|||||||
var args []string
|
var args []string
|
||||||
args = append(args, "--bitcoin.node=neutrino")
|
args = append(args, "--bitcoin.node=neutrino")
|
||||||
args = append(args, "--neutrino.connect="+b.minerAddr)
|
args = append(args, "--neutrino.connect="+b.minerAddr)
|
||||||
|
// We enable validating channels so that we can obtain the outpoint for
|
||||||
|
// channels within the graph and make certain assertions based on them.
|
||||||
|
args = append(args, "--neutrino.validatechannels")
|
||||||
return args
|
return args
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,13 +476,17 @@ bitcoin.node=btcd
|
|||||||
; Used to help identify ourselves to other bitcoin peers (default: 0.11.0-beta).
|
; Used to help identify ourselves to other bitcoin peers (default: 0.11.0-beta).
|
||||||
; neutrino.useragentversion=0.11.0-beta
|
; neutrino.useragentversion=0.11.0-beta
|
||||||
|
|
||||||
; Skip checking channel spentness and existence during graph validation for
|
; Validate every channel in the graph during sync by downloading the containing
|
||||||
; neutrino. Enabling this option means that neutrino nodes will not need to
|
; block. This is the inverse of routing.assumechanvalid, meaning that for
|
||||||
; perform long rescans which block initial usage of the daemon, but comes at
|
; Neutrino the validation is turned off by default for massively increased graph
|
||||||
; the cost of not validating channels in your routing graph. Skipping this
|
; sync performance. This speedup comes at the risk of using an unvalidated view
|
||||||
; validation means that your node may have an incorrect view of the network
|
; of the network for routing. Overwrites the value of routing.assumechanvalid if
|
||||||
; if it receives updates for closed or non-existent channels. This could affect
|
; Neutrino is used. (default: false)
|
||||||
; routing, but funds are safu.
|
; neutrino.validatechannels=false
|
||||||
|
|
||||||
|
; DEPRECATED: This is now turned on by default for Neutrino (use
|
||||||
|
; neutrino.validatechannels=true to turn off) and shouldn't be used for any
|
||||||
|
; other backend!
|
||||||
; --routing.assumechanvalid=true
|
; --routing.assumechanvalid=true
|
||||||
|
|
||||||
[Btcd]
|
[Btcd]
|
||||||
|
Loading…
Reference in New Issue
Block a user