Skip to content

Allow minting paid quotes after expiry - #1122

Draft
Egge21M wants to merge 1 commit into
cashubtc:mainfrom
Egge21M:fix/mint-paid-quotes-after-expiry
Draft

Allow minting paid quotes after expiry#1122
Egge21M wants to merge 1 commit into
cashubtc:mainfrom
Egge21M:fix/mint-paid-quotes-after-expiry

Conversation

@Egge21M

@Egge21M Egge21M commented Aug 15, 2026

Copy link
Copy Markdown

Summary

  • remove the issuance-time expiry rejection from single and batch minting
  • keep payment-state, amount, witness, pending, and issued checks unchanged
  • add regression coverage for minting paid quotes after their expiry timestamp

Root cause

Nutshell records a mint quote as paid when its Lightning backend reports the invoice settled, but mint and mint_batch independently rejected that paid quote once its expiry timestamp passed. This could leave a successfully paid quote permanently unmintable if the wallet did not request signatures before expiry.

Quote expiry limits when the payment request can be paid. Once payment is confirmed, the paid value should remain mintable until it has been issued.

Impact

Wallets can recover ecash from paid quotes after expiry, including through the batch endpoint. Unpaid quotes remain unmintable, and the existing state transitions continue to prevent duplicate issuance.

Validation

  • pytest tests/mint/test_mint.py tests/mint/test_mint_batch.py -q — 37 passed
  • ruff check cashu/mint/ledger.py tests/mint/test_mint.py tests/mint/test_mint_batch.py

@codecov

codecov Bot commented Aug 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.44%. Comparing base (e5ea0ca) to head (a89154b).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
cashu/mint/ledger.py 80.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1122   +/-   ##
=======================================
  Coverage   74.43%   74.44%           
=======================================
  Files         113      113           
  Lines       12753    12748    -5     
=======================================
- Hits         9493     9490    -3     
+ Misses       3260     3258    -2     

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

Comment thread cashu/mint/ledger.py
Comment on lines +600 to +605
if quote.state != MintQuoteState.paid:
raise QuoteNotPaidError()

# Quote expiry limits payment, not issuance of already-paid value.

# Check amount balance

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this change isn't needed

Comment thread cashu/mint/ledger.py
Comment on lines +514 to +520
if quote.state != MintQuoteState.paid:
raise QuoteNotPaidError()

# Quote expiry limits when the payment request can be paid. Once payment is
# confirmed, the quote remains mintable until its value has been issued.

previous_state = quote.state

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this change isn't needed

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