Skip to content

Commit

Permalink
Merge pull request #4589 from cerblue/cerblue
Browse files Browse the repository at this point in the history
Do not fail wallet delete because of pre-existing trashed key
  • Loading branch information
magik6k authored Oct 26, 2020
2 parents d4cdc6d + bfbf6a2 commit ce9cce9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chain/wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit ce9cce9

Please sign in to comment.