lncli: don't read macaroons when not using them

When we either don't use macaroons (because the global --no-macaroons
flag is set) or don't need them (for the wallet unlocker commands), we
don't try to read the file at all to avoid running into an error if the
file doesn't exist (which it doesn't in those two cases).
This commit is contained in:
Oliver Gugger
2020-09-25 15:38:40 +02:00
parent 44524fd2e5
commit b28bf29c5f
3 changed files with 37 additions and 23 deletions

View File

@ -70,7 +70,7 @@ func getClient(ctx *cli.Context) (lnrpc.LightningClient, func()) {
func getClientConn(ctx *cli.Context, skipMacaroons bool) *grpc.ClientConn {
// First, we'll get the selected stored profile or an ephemeral one
// created from the global options in the CLI context.
profile, err := getGlobalOptions(ctx)
profile, err := getGlobalOptions(ctx, skipMacaroons)
if err != nil {
fatal(fmt.Errorf("could not load global options: %v", err))
}