mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-19 05:45:21 +01:00
config: determine the bitcoind chain directory from the chain params instead of the config file. This is more reliable in case the chain was selected with a bitcoind commandline option instead of a line in the config file.
This commit is contained in:
parent
6c00de1865
commit
c2e5ba3b43
19
config.go
19
config.go
@ -1046,18 +1046,13 @@ func extractBitcoindRPCParams(bitcoindConfigPath string) (string, string, string
|
||||
}
|
||||
|
||||
chainDir := "/"
|
||||
netRE, err := regexp.Compile(`(?m)^\s*(testnet|regtest)=[\d]+`)
|
||||
if err != nil {
|
||||
return "", "", "", err
|
||||
}
|
||||
netSubmatches := netRE.FindSubmatch(configContents)
|
||||
if netSubmatches != nil {
|
||||
switch string(netSubmatches[1]) {
|
||||
case "testnet":
|
||||
chainDir = "/testnet3/"
|
||||
case "regtest":
|
||||
chainDir = "/regtest/"
|
||||
}
|
||||
switch activeNetParams.Params.Name {
|
||||
case "testnet3":
|
||||
chainDir = "/testnet3/"
|
||||
case "testnet4":
|
||||
chainDir = "/testnet4/"
|
||||
case "regtest":
|
||||
chainDir = "/regtest/"
|
||||
}
|
||||
|
||||
cookie, err := ioutil.ReadFile(dataDir + chainDir + ".cookie")
|
||||
|
Loading…
Reference in New Issue
Block a user