Skip to content

fix(mint): resolve pending proofs hang from internal settlement failure#967

Open
a1denvalu3 wants to merge 9 commits into
mainfrom
fix-melt-internal-pending-lockup
Open

fix(mint): resolve pending proofs hang from internal settlement failure#967
a1denvalu3 wants to merge 9 commits into
mainfrom
fix-melt-internal-pending-lockup

Conversation

@a1denvalu3
Copy link
Copy Markdown
Collaborator

@a1denvalu3 a1denvalu3 commented Mar 31, 2026

Summary

Resolves an issue where proofs could become permanently locked in a PENDING state during a failed internal settlement.

This fixes two connected bugs:

  1. Added a try/except block in melt() around melt_mint_settle_internally to ensure pending proofs and quotes are reset to UNPAID if the internal settlement throws an error (e.g., quote already issued).
  2. Updated get_melt_quote() so that periodic cleanup correctly handles stuck internal melt quotes by un-setting their pending proofs if the corresponding mint quote is no longer unpaid, instead of unconditionally ignoring them.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 31, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.16%. Comparing base (f32a6ce) to head (596e9c3).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
cashu/mint/conditions.py 70.37% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #967      +/-   ##
==========================================
+ Coverage   75.14%   75.16%   +0.01%     
==========================================
  Files          99       99              
  Lines       11714    11725      +11     
==========================================
+ Hits         8803     8813      +10     
- Misses       2911     2912       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@a1denvalu3 a1denvalu3 marked this pull request as draft March 31, 2026 14:46
@a1denvalu3 a1denvalu3 marked this pull request as ready for review March 31, 2026 15:20
@a1denvalu3 a1denvalu3 changed the title fix(mint): resolve permanent pending proof lockup via internal settlement failure fix(mint): resolve pending proofs hang from internal settlement failure Apr 1, 2026
@a1denvalu3 a1denvalu3 force-pushed the fix-melt-internal-pending-lockup branch from bfa2645 to b192e2c Compare April 1, 2026 10:12
@a1denvalu3 a1denvalu3 force-pushed the fix-melt-internal-pending-lockup branch from b192e2c to 288ed1d Compare April 2, 2026 10:16
KvngMikey
KvngMikey approved these changes Apr 3, 2026
Reverts the background reset logic for stuck pending internal melt quotes
in `get_melt_quote`. As noted by the maintainer, it is the mint operator's
prerogative to handle stuck pending quotes, and automating this introduces
a race condition vulnerability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants