nutshell icon indicating copy to clipboard operation
nutshell copied to clipboard

Mark Keysets as Deleted.

Open KvngMikey opened this issue 3 months ago • 1 comments

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).

KvngMikey avatar Oct 05 '25 18:10 KvngMikey

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 avatar Oct 08 '25 14:10 KvngMikey

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?

callebtc avatar Nov 30 '25 17:11 callebtc

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.

KvngMikey avatar Dec 01 '25 07:12 KvngMikey