|
51 | 51 | // deprecated --lnd.macaroondir config option is used. |
52 | 52 | defaultLndMacaroon = "admin.macaroon" |
53 | 53 |
|
| 54 | + // DefaultLndMacaroonPath is the default mainnet admin macaroon path of |
| 55 | + // LND. |
| 56 | + DefaultLndMacaroonPath = filepath.Join( |
| 57 | + btcutil.AppDataDir("lnd", false), |
| 58 | + "data", "chain", "bitcoin", DefaultNetwork, |
| 59 | + defaultLndMacaroon, |
| 60 | + ) |
| 61 | + |
54 | 62 | // DefaultTLSCertPath is the default full path of the autogenerated TLS |
55 | 63 | // certificate. |
56 | 64 | DefaultTLSCertPath = filepath.Join( |
@@ -171,12 +179,8 @@ func DefaultConfig() Config { |
171 | 179 | MaxLSATFee: lsat.DefaultMaxRoutingFeeSats, |
172 | 180 | LoopOutMaxParts: defaultLoopOutMaxParts, |
173 | 181 | Lnd: &lndConfig{ |
174 | | - Host: "localhost:10009", |
175 | | - MacaroonPath: filepath.Join( |
176 | | - btcutil.AppDataDir("lnd", false), |
177 | | - "data", "chain", "bitcoin", DefaultNetwork, |
178 | | - "admin.macaroon", |
179 | | - ), |
| 182 | + Host: "localhost:10009", |
| 183 | + MacaroonPath: DefaultLndMacaroonPath, |
180 | 184 | }, |
181 | 185 | } |
182 | 186 | } |
@@ -252,6 +256,16 @@ func Validate(cfg *Config) error { |
252 | 256 | ) |
253 | 257 | } |
254 | 258 |
|
| 259 | + // If the user doesn't specify Lnd.MacaroonPath, we'll reassemble it |
| 260 | + // with the passed Network options. |
| 261 | + if cfg.Lnd.MacaroonPath == DefaultLndMacaroonPath { |
| 262 | + cfg.Lnd.MacaroonPath = filepath.Join( |
| 263 | + btcutil.AppDataDir("lnd", false), |
| 264 | + "data", "chain", "bitcoin", cfg.Network, |
| 265 | + defaultLndMacaroon, |
| 266 | + ) |
| 267 | + } |
| 268 | + |
255 | 269 | // If either of these directories do not exist, create them. |
256 | 270 | if err := os.MkdirAll(cfg.DataDir, os.ModePerm); err != nil { |
257 | 271 | return err |
|
0 commit comments