From b3edc5c257ad9cf0c72d86fe02a7c2e21dd41f03 Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Wed, 15 Aug 2018 15:16:16 -0700 Subject: [PATCH] walletunlocker: avoid returning error if macaroon files don't exist In this commit, we fix a bug where it's possible that changing the wallet's password fails due to not being able to remove non-existent macaroon files. Since it's possible to run lnd without creating them, changing the wallet's password would always result in a failure. --- walletunlocker/service.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/walletunlocker/service.go b/walletunlocker/service.go index 5ab9f0683..c3fd45f2f 100644 --- a/walletunlocker/service.go +++ b/walletunlocker/service.go @@ -334,7 +334,8 @@ func (u *UnlockerService) ChangePassword(ctx context.Context, // this after unlocking the wallet to ensure macaroon files don't get // deleted with incorrect password attempts. for _, file := range u.macaroonFiles { - if err := os.Remove(file); err != nil { + err := os.Remove(file) + if err != nil && !os.IsNotExist(err) { return nil, err } }