diff --git a/cashu/mint/crud.py b/cashu/mint/crud.py index fd95317a..853ff094 100644 --- a/cashu/mint/crud.py +++ b/cashu/mint/crud.py @@ -47,8 +47,8 @@ async def get_spent_proofs( async def get_proof_used( self, *, - db: Database, Y: str, + db: Database, conn: Optional[Connection] = None, ) -> Optional[Proof]: ... @@ -598,8 +598,9 @@ async def get_keyset( async def get_proof_used( self, - db: Database, + *, Y: str, + db: Database, conn: Optional[Connection] = None, ) -> Optional[Proof]: row = await (conn or db).fetchone( diff --git a/cashu/mint/verification.py b/cashu/mint/verification.py index 25fa2ae3..e3da1d54 100644 --- a/cashu/mint/verification.py +++ b/cashu/mint/verification.py @@ -163,8 +163,9 @@ async def _get_proofs_spent_idx_secret( if settings.mint_cache_secrets: # check used secrets in memory for proof in proofs: - if proof.Y in self.spent_proofs: - proofs_spent.append(proof) + spent_proof = self.spent_proofs.get(proof.Y) + if spent_proof: + proofs_spent.append(spent_proof) else: # check used secrets in database async with self.db.connect() as conn: