Mark Keysets as Deleted.#797
Conversation
callebtc
left a comment
There was a problem hiding this comment.
LGTM but one outstanding question regarding the removed line await self.load_keysets_from_db()
what's the justification for that?
@callebtc I replaced "await self.load_keysets_from_db()" because we now build self.keysets inline with the already-fetched list (keysets_in_db) filtered by k.unit == self.unit and k.active. |
|
Hi @KvngMikey, sorry for getting back to you late. We have a crud called |
hi @callebtc , thanks for checking my work, I have addressed your request now. |
|
we talked about this off band: there should probably be a boolean |
yes, i remember and i'm working on it. |
9a9688c to
dfd79ed
Compare
|
@callebtc PR updated, ready for re-review, thank you. |
|
question: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #797 +/- ##
==========================================
+ Coverage 75.27% 75.34% +0.07%
==========================================
Files 111 111
Lines 12431 12451 +20
==========================================
+ Hits 9357 9381 +24
+ Misses 3074 3070 -4 ☔ View full report in Codecov by Harness. |
nope, this is just for the wallet and not related to the API. the mint just deletes the keyset |
great, thank you ! |
d1aa49d to
6624071
Compare
|
@callebtc - this has also been rebased and is ready. cc @a1denvalu3 |
4b4ccac to
5364262
Compare
title: "Wallet permanently loses unspent funds when a mint stops reporting a keyset"
|
title: "Reappearing keysets are never undeleted, causing permanent loss of funds"
|
SummaryThe pull request introduces a Root CauseIn async def load_keysets_from_db(
self, url: Union[str, None] = "", unit: Union[str, None] = ""
):
...
keysets = await get_keysets(mint_url=url, unit=unit, db=self.db)
self.keysets = {k.id: k for k in keysets}The During token reception, assert proof.id in self.keysets, (
f"Keyset {proof.id} not known, can not verify DLEQ."
)If a user receives a token belonging to a deleted keyset, |
Fixes #731
Summary
This PR fixes the wallet behavior when a keyset disappears from a mint's
/keysetsresponse.Changes
load_mint_keysetsto mark missing keysets as deleted.update_keyset_activeincrud.pyto use named SQL parameters for SQLAlchemy async compatibility.pytest tests/wallet/test_wallet.py -k keyset(all keyset tests now pass).