Merge pull request #4705 from filecoin-project/asr/delete-default

Correctly delete the default wallet address
This commit is contained in:
Łukasz Magiera 2020-11-03 11:44:25 +01:00 committed by GitHub
commit b7b6252048
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -305,6 +305,18 @@ func (w *LocalWallet) WalletDelete(ctx context.Context, addr address.Address) er
delete(w.keys, addr)
def, err := w.GetDefault()
if err != nil {
return xerrors.Errorf("getting default address: %w", err)
}
if def == addr {
err = w.SetDefault(address.Undef)
if err != nil {
return xerrors.Errorf("unsetting default address: %w", err)
}
}
return nil
}