Skip to content

Commit 4b313a5

Browse files
authored
Merge pull request #6536 from ErikEk/cookie-missing-error-msg-fix
config: error msg for missing bitcoind cookie file
2 parents c647d32 + fbf00f6 commit 4b313a5

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

config.go

+12-4
Original file line numberDiff line numberDiff line change
@@ -2001,10 +2001,6 @@ func extractBitcoindRPCParams(networkName, bitcoindDataDir, bitcoindConfigPath,
20012001
return "", "", "", "", err
20022002
}
20032003
userSubmatches := rpcUserRegexp.FindSubmatch(configContents)
2004-
if userSubmatches == nil {
2005-
return "", "", "", "", fmt.Errorf("unable to find rpcuser in " +
2006-
"config")
2007-
}
20082004

20092005
// Similarly, we'll use another regular expression to find the set
20102006
// rpcpass (if any). If we can't find the pass, then we'll exit with an
@@ -2014,6 +2010,18 @@ func extractBitcoindRPCParams(networkName, bitcoindDataDir, bitcoindConfigPath,
20142010
return "", "", "", "", err
20152011
}
20162012
passSubmatches := rpcPassRegexp.FindSubmatch(configContents)
2013+
2014+
// Exit with an error if the cookie file, is defined in config, and
2015+
// can not be found, with both rpcuser and rpcpassword undefined.
2016+
if rpcCookiePath != "" && userSubmatches == nil && passSubmatches == nil {
2017+
return "", "", "", "", fmt.Errorf("unable to open cookie file (%v)",
2018+
rpcCookiePath)
2019+
}
2020+
2021+
if userSubmatches == nil {
2022+
return "", "", "", "", fmt.Errorf("unable to find rpcuser in " +
2023+
"config")
2024+
}
20172025
if passSubmatches == nil {
20182026
return "", "", "", "", fmt.Errorf("unable to find rpcpassword " +
20192027
"in config")

docs/release-notes/release-notes-0.15.0.md

+2
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ from occurring that would result in an erroneous force close.](https://github.co
258258

259259
* [Some of the invoice update logic has been refactored to be less verbose.](https://github.com/lightningnetwork/lnd/pull/6415)
260260

261+
* [Clarify error msg when bitcoind cookie file is missing](https://github.com/lightningnetwork/lnd/pull/6536).
262+
261263
## RPC Server
262264

263265
* [Add value to the field

0 commit comments

Comments
 (0)