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.
This commit is contained in:
Wilmer Paulino 2018-08-15 15:16:16 -07:00
parent 999f4a742c
commit b3edc5c257
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

View File

@ -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
}
}