Skip to content

fix(mint): return null expiry for no-expiry Bolt12 quotes#2199

Merged
thesimplekid merged 1 commit into
cashubtc:mainfrom
thesimplekid:fix_bolt12_zero_expiry
Jul 8, 2026
Merged

fix(mint): return null expiry for no-expiry Bolt12 quotes#2199
thesimplekid merged 1 commit into
cashubtc:mainfrom
thesimplekid:fix_bolt12_zero_expiry

Conversation

@thesimplekid

Copy link
Copy Markdown
Collaborator

Map the internal 0 expiry sentinel back to None when converting Bolt12 mint quotes to API responses, matching the onchain conversion behavior.

Add regression coverage for direct and generic Bolt12 quote response paths.

fixes: #2195

Description


Notes to the reviewers


Suggested CHANGELOG Updates

CHANGED

ADDED

REMOVED

FIXED


Checklist

  • I followed the code style guidelines
  • I ran just quick-check before committing
  • If the Wallet API was modified (added/removed/changed), I have reflected those changes in the FFI bindings (crates/cdk-ffi)

@thesimplekid thesimplekid added this to the 0.17.3 milestone Jul 4, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in CDK Jul 4, 2026
@thesimplekid

Copy link
Copy Markdown
Collaborator Author

@cdk-bot review

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.03922% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 72.98%. Comparing base (10cab2a) to head (18d3003).

Files with missing lines Patch % Lines
crates/cdk-common/src/mint.rs 98.03% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2199      +/-   ##
==========================================
+ Coverage   72.95%   72.98%   +0.03%     
==========================================
  Files         359      359              
  Lines       79276    79325      +49     
==========================================
+ Hits        57834    57897      +63     
+ Misses      21442    21428      -14     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@j-kon j-kon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I reviewed the change and it looks good to me.

The fix maps the internal 0 expiry sentinel back to None in both Bolt12 response conversion paths, which matches the expected no-expiry behavior and the on-chain quote convention.

The regression tests also cover the main cases well: direct Bolt12 zero-expiry, direct Bolt12 non-zero expiry, and the generic Bolt12 response path for zero-expiry.

One small optional note: Codecov is showing one changed line missing coverage, which may be the generic Bolt12 response path for non-zero expiry. If needed, adding a small check for MintQuoteResponse::Bolt12 preserving a non-zero expiry would likely cover that too.

Nice fix overall.

@thesimplekid thesimplekid force-pushed the fix_bolt12_zero_expiry branch from 5df1a22 to b9380ac Compare July 6, 2026 17:08
Map the internal 0 expiry sentinel back to None when converting Bolt12
mint quotes to API responses, matching the onchain conversion behavior.

Add regression coverage for direct and generic Bolt12 quote response paths.
@thesimplekid thesimplekid force-pushed the fix_bolt12_zero_expiry branch from b9380ac to 18d3003 Compare July 7, 2026 21:27
@thesimplekid thesimplekid merged commit 18d3003 into cashubtc:main Jul 8, 2026
48 checks passed
@thesimplekid thesimplekid deleted the fix_bolt12_zero_expiry branch July 8, 2026 08:02
@github-project-automation github-project-automation Bot moved this from Backlog to Done in CDK Jul 8, 2026
@cdk-bot

cdk-bot commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Backport failed for v0.17.x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin v0.17.x
git worktree add -d .worktree/backport-2199-to-v0.17.x origin/v0.17.x
cd .worktree/backport-2199-to-v0.17.x
git switch --create backport-2199-to-v0.17.x
git cherry-pick -x 18d300326a6d8bd9fba1586a2c688cb7934df0e0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Bolt12 mint quote serializes expiry: 0 instead of null for no-expiry offers

3 participants