Skip to content

feat(mint): loosen NUT-29 batch quote checks - #1114

Draft
a1denvalu3 wants to merge 2 commits into
cashubtc:mainfrom
a1denvalu3:feat/nut-29-loosen-batch-quote-checks
Draft

feat(mint): loosen NUT-29 batch quote checks#1114
a1denvalu3 wants to merge 2 commits into
cashubtc:mainfrom
a1denvalu3:feat/nut-29-loosen-batch-quote-checks

Conversation

@a1denvalu3

@a1denvalu3 a1denvalu3 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • return exactly one NUT-29 batch-check entry per requested quote ID, preserving request order
  • return positional { "quote": <id>, "unknown": true } entries for unknown or malformed quote IDs
  • use the NUT-04 accounting response fields and omit the deprecated state field from batch-check quote responses
  • validate batch-mint eligibility using the currently mintable amount (amount_paid - amount_issued)
  • add ledger and HTTP API coverage for mixed known/unknown and all-unknown requests

Implements the proposed changes in cashubtc/nuts#422 at spec commit ce8539c7. This is protocol-sensitive and remains a draft pending maintainer review.

Validation

  • MINT_BACKEND_BOLT11_SAT=FakeWallet TOR=FALSE poetry run pytest tests/mint/test_mint_batch.py tests/mint/test_mint_api.py -q (40 passed, 2 skipped)
  • latest behavior-focused tests (5 passed)
  • poetry run ruff check cashu/core/models/mint_quote.py cashu/core/models/__init__.py cashu/mint/router.py cashu/mint/ledger.py tests/mint/test_mint_batch.py tests/mint/test_mint_api.py
  • poetry run mypy cashu/core/models/mint_quote.py cashu/mint/router.py cashu/mint/ledger.py
  • git diff --check

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.87500% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 74.48%. Comparing base (0ae760f) to head (1ceeb2c).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
cashu/mint/ledger.py 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1114      +/-   ##
==========================================
+ Coverage   74.35%   74.48%   +0.12%     
==========================================
  Files         115      115              
  Lines       13155    13172      +17     
==========================================
+ Hits         9782     9811      +29     
+ Misses       3373     3361      -12     

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

@a1denvalu3
a1denvalu3 marked this pull request as draft August 12, 2026 12:50
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.

1 participant