Merge pull request #4589 from cerblue/cerblue
Do not fail wallet delete because of pre-existing trashed key
This commit is contained in:
commit
ce9cce921d
@ -283,6 +283,10 @@ func (w *LocalWallet) WalletDelete(ctx context.Context, addr address.Address) er
|
||||
w.lk.Lock()
|
||||
defer w.lk.Unlock()
|
||||
|
||||
if err := w.keystore.Delete(KTrashPrefix + k.Address.String()); err != nil && !xerrors.Is(err, types.ErrKeyInfoNotFound) {
|
||||
return xerrors.Errorf("failed to purge trashed key %s: %w", addr, err)
|
||||
}
|
||||
|
||||
if err := w.keystore.Put(KTrashPrefix+k.Address.String(), k.KeyInfo); err != nil {
|
||||
return xerrors.Errorf("failed to mark key %s as trashed: %w", addr, err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user