Skip to content

Commit

Permalink
get full proof from memory
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Feb 10, 2024
1 parent 4d3df1f commit dd38a18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions cashu/mint/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]: ...

Expand Down Expand Up @@ -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(
Expand Down
5 changes: 3 additions & 2 deletions cashu/mint/verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit dd38a18

Please sign in to comment.