Skip to content

Commit cbe71ac

Browse files
committed
config: fix empty default remote lnd admin mac path
Partially reverts c917e91 and fixes #195: The default remote lnd admin macaroon path we added in c917e91 was a mistake since by default that value isn't set until we call lnd.ValidateConfig() which we never do in the remote mode. We fix this by providing a sane default value for the admin macaroon again.
1 parent 1724184 commit cbe71ac

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

config.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const (
6565
defaultRemotePoolRpcServer = "localhost:12010"
6666
defaultLndChainSubDir = "chain"
6767
defaultLndChain = "bitcoin"
68+
defaultLndMacaroon = "admin.macaroon"
6869
)
6970

7071
var (
@@ -104,6 +105,13 @@ var (
104105
defaultLetsEncryptDir = filepath.Join(
105106
defaultLitDir, defaultLetsEncryptSubDir,
106107
)
108+
109+
// defaultRemoteLndMacaroonPath is the default path we assume for a
110+
// local lnd node to store its admin.macaroon file at.
111+
defaultRemoteLndMacaroonPath = filepath.Join(
112+
lndDefaultConfig.DataDir, defaultLndChainSubDir,
113+
defaultLndChain, defaultNetwork, defaultLndMacaroon,
114+
)
107115
)
108116

109117
// Config is the main configuration struct of lightning-terminal. It contains
@@ -248,7 +256,7 @@ func defaultConfig() *Config {
248256
LitMaxLogFileSize: defaultMaxLogFileSize,
249257
Lnd: &RemoteDaemonConfig{
250258
RPCServer: defaultRemoteLndRpcServer,
251-
MacaroonPath: lndDefaultConfig.AdminMacPath,
259+
MacaroonPath: defaultRemoteLndMacaroonPath,
252260
TLSCertPath: lndDefaultConfig.TLSCertPath,
253261
},
254262
Faraday: &RemoteDaemonConfig{
@@ -526,7 +534,7 @@ func validateRemoteModeConfig(cfg *Config) error {
526534
// specify --network=testnet for example if everything else is using
527535
// the defaults.
528536
if cfg.Network != defaultNetwork &&
529-
r.Lnd.MacaroonPath == defaultLndCfg.AdminMacPath {
537+
r.Lnd.MacaroonPath == defaultRemoteLndMacaroonPath {
530538

531539
r.Lnd.MacaroonPath = filepath.Join(
532540
defaultLndCfg.DataDir, defaultLndChainSubDir,

0 commit comments

Comments
 (0)