mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
Merge pull request #434 from arshbot/default-macaroon-locations
loopd: Consider network when making LND paths
This commit is contained in:
commit
52087c8bb4
2 changed files with 22 additions and 6 deletions
|
|
@ -51,6 +51,14 @@ var (
|
|||
// deprecated --lnd.macaroondir config option is used.
|
||||
defaultLndMacaroon = "admin.macaroon"
|
||||
|
||||
// DefaultLndMacaroonPath is the default mainnet admin macaroon path of
|
||||
// LND.
|
||||
DefaultLndMacaroonPath = filepath.Join(
|
||||
btcutil.AppDataDir("lnd", false),
|
||||
"data", "chain", "bitcoin", DefaultNetwork,
|
||||
defaultLndMacaroon,
|
||||
)
|
||||
|
||||
// DefaultTLSCertPath is the default full path of the autogenerated TLS
|
||||
// certificate.
|
||||
DefaultTLSCertPath = filepath.Join(
|
||||
|
|
@ -171,12 +179,8 @@ func DefaultConfig() Config {
|
|||
MaxLSATFee: lsat.DefaultMaxRoutingFeeSats,
|
||||
LoopOutMaxParts: defaultLoopOutMaxParts,
|
||||
Lnd: &lndConfig{
|
||||
Host: "localhost:10009",
|
||||
MacaroonPath: filepath.Join(
|
||||
btcutil.AppDataDir("lnd", false),
|
||||
"data", "chain", "bitcoin", DefaultNetwork,
|
||||
"admin.macaroon",
|
||||
),
|
||||
Host: "localhost:10009",
|
||||
MacaroonPath: DefaultLndMacaroonPath,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -252,6 +256,16 @@ func Validate(cfg *Config) error {
|
|||
)
|
||||
}
|
||||
|
||||
// If the user doesn't specify Lnd.MacaroonPath, we'll reassemble it
|
||||
// with the passed Network options.
|
||||
if cfg.Lnd.MacaroonPath == DefaultLndMacaroonPath {
|
||||
cfg.Lnd.MacaroonPath = filepath.Join(
|
||||
btcutil.AppDataDir("lnd", false),
|
||||
"data", "chain", "bitcoin", cfg.Network,
|
||||
defaultLndMacaroon,
|
||||
)
|
||||
}
|
||||
|
||||
// If either of these directories do not exist, create them.
|
||||
if err := os.MkdirAll(cfg.DataDir, os.ModePerm); err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -29,4 +29,6 @@ This file tracks release notes for the loop client.
|
|||
|
||||
#### Bug Fixes
|
||||
|
||||
* Fixed issue where loop assumes the mainnet location for lnd.macaroonpath regardless of passed network parameters.
|
||||
|
||||
#### Maintenance
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue