Skip to content

Conversation

@KvngMikey
Copy link

Fixes #731

Summary

This PR fixes the wallet behavior when a keyset disappears from a mint's /keysets response.

Changes

  • Updated load_mint_keysets to mark missing keysets as inactive.
  • Added update_keyset_active in crud.py to use named SQL parameters for SQLAlchemy async compatibility.
  • Verified with pytest tests/wallet/test_wallet.py -k keyset (all keyset tests now pass).

Copy link
Collaborator

@callebtc callebtc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but one outstanding question regarding the removed line await self.load_keysets_from_db()

what's the justification for that?

@KvngMikey
Copy link
Author

KvngMikey commented Oct 8, 2025

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.
That list is fresh (we re-fetch after marking inactive), so the old helper’s extra query + loop is redundant.
The trace message is still printed two lines below, so no observability is lost.

@KvngMikey KvngMikey requested a review from callebtc October 8, 2025 14:21
@callebtc
Copy link
Collaborator

Hi @KvngMikey, sorry for getting back to you late. We have a crud called update_keyset that supports setting the active flag (latest main also can update the fee, worth a merge of main into this branch). Why not use that directly?

@KvngMikey
Copy link
Author

Hi @KvngMikey, sorry for getting back to you late. We have a crud called update_keyset that supports setting the active flag (latest main also can update the fee, worth a merge of main into this branch). Why not use that directly?

hi @callebtc , thanks for checking my work, I have addressed your request now.

@callebtc
Copy link
Collaborator

we talked about this off band: there should probably be a boolean deleted column in the keyset table of the wallet and if we flip it to True, the keyset shouldn't be loaded from the db, when we use load_keysets(). wanna try that?

@KvngMikey
Copy link
Author

we talked about this off band: there should probably be a boolean deleted column in the keyset table of the wallet and if we flip it to True, the keyset shouldn't be loaded from the db, when we use load_keysets(). wanna try that?

yes, i remember and i'm working on it.

@KvngMikey KvngMikey force-pushed the wallet-deleted-keysets branch from 9a9688c to dfd79ed Compare December 18, 2025 21:28
@KvngMikey
Copy link
Author

@callebtc PR updated, ready for re-review, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Wallet should mark keysets as "deleted" if they disappear from the mint's keysets response

2 participants