You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Deleting a user wallet the second time returns 404 instead of removing it #4149
Describe the bug
On the admin Users page, deleting a wallet the second time should delete it for good. The endpoint says so: the first call is a soft delete, the second call removes the row. But the second call returns 404 "Wallet does not exist." and the wallet stays in the database with deleted = true.
To Reproduce
Log in as admin and open the Users page.
Open the wallets of a user and delete one wallet. This works, the wallet is marked as deleted.
Delete the same wallet again. The dialog says "Wallet is already deleted, are you sure you want to permanently delete this user wallet?" Confirm.
The API answers 404 and shows an error. The wallet is still in the database.
Same with the API: DELETE /users/api/v1/user/{user_id}/wallet/{wallet_id} two times.
Expected behavior
The second delete removes the wallet, like the endpoint summary says.
Desktop (please complete the following information):
Additional context
In lnbits/core/views/user_api.py, api_users_delete_user_wallet calls get_wallet(wallet). The default of get_wallet is deleted=False, so a soft deleted wallet is not found and the force_delete_wallet branch below is never reached. The undelete endpoint next to it passes deleted=True.
Activity