Skip to content

Commit

Permalink
Merge pull request #196 from lightninglabs/default-admin-mac-path
Browse files Browse the repository at this point in the history
config: fix empty default remote lnd admin mac path
  • Loading branch information
guggero committed Mar 5, 2021
2 parents 1724184 + cbe71ac commit aad7fc5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const (
defaultRemotePoolRpcServer = "localhost:12010"
defaultLndChainSubDir = "chain"
defaultLndChain = "bitcoin"
defaultLndMacaroon = "admin.macaroon"
)

var (
Expand Down Expand Up @@ -104,6 +105,13 @@ var (
defaultLetsEncryptDir = filepath.Join(
defaultLitDir, defaultLetsEncryptSubDir,
)

// defaultRemoteLndMacaroonPath is the default path we assume for a
// local lnd node to store its admin.macaroon file at.
defaultRemoteLndMacaroonPath = filepath.Join(
lndDefaultConfig.DataDir, defaultLndChainSubDir,
defaultLndChain, defaultNetwork, defaultLndMacaroon,
)
)

// Config is the main configuration struct of lightning-terminal. It contains
Expand Down Expand Up @@ -248,7 +256,7 @@ func defaultConfig() *Config {
LitMaxLogFileSize: defaultMaxLogFileSize,
Lnd: &RemoteDaemonConfig{
RPCServer: defaultRemoteLndRpcServer,
MacaroonPath: lndDefaultConfig.AdminMacPath,
MacaroonPath: defaultRemoteLndMacaroonPath,
TLSCertPath: lndDefaultConfig.TLSCertPath,
},
Faraday: &RemoteDaemonConfig{
Expand Down Expand Up @@ -526,7 +534,7 @@ func validateRemoteModeConfig(cfg *Config) error {
// specify --network=testnet for example if everything else is using
// the defaults.
if cfg.Network != defaultNetwork &&
r.Lnd.MacaroonPath == defaultLndCfg.AdminMacPath {
r.Lnd.MacaroonPath == defaultRemoteLndMacaroonPath {

r.Lnd.MacaroonPath = filepath.Join(
defaultLndCfg.DataDir, defaultLndChainSubDir,
Expand Down

0 comments on commit aad7fc5

Please sign in to comment.