Skip to content

Don't panic when a same-mint melt settles without a preimage - #92

Merged
benthecarman merged 1 commit into
lightningdevkit:masterfrom
emergent-money:fix/same-mint-melt-no-preimage
Jul 26, 2026
Merged

Don't panic when a same-mint melt settles without a preimage#92
benthecarman merged 1 commit into
lightningdevkit:masterfrom
emergent-money:fix/same-mint-melt-no-preimage

Conversation

@hash-money

Copy link
Copy Markdown
Contributor

Fixes #91. cdk-mintd settles same-mint payments internally (no Lightning payment → no payment_proof), so the melt-success None-preimage arm is a legitimate, reachable case — but it carries a debug_assert!(false) that panics every debug build the moment two wallets sharing a mint pay each other (full repro in #91; hits us on every trusted→trusted transfer between staging test wallets).

The success path already handles None (event hash falls back to the invoice payment_hash, which is always present for these melts), so the fix is just: stop asserting, log the expected case at info. cargo test -p orange-sdk --lib 17/17.

@benthecarman

Copy link
Copy Markdown
Collaborator

lgtm but is built on #89, can you make this on top of master

When a melt's bolt11 destination is a mint quote on the same mint,
cdk-mintd settles it internally — no Lightning payment occurs and the
melt result legitimately carries no payment_proof. The success path
already tolerates a missing preimage (the event hash falls back to the
invoice payment_hash), but the None arm carried a debug_assert!(false)
that panics any debug build the moment two wallets sharing a mint pay
each other.

Downgrade to an explanatory log_info; fixes lightningdevkit#91.
@hash-money
hash-money force-pushed the fix/same-mint-melt-no-preimage branch from 356ce16 to 5a43c3e Compare July 25, 2026 01:34
@hash-money

Copy link
Copy Markdown
Contributor Author

Rebased onto master — this branch now carries only the same-mint melt fix; the #89 list_transactions commit is dropped and stays as its own PR. Applies cleanly on current master (5a540f6), no changes beyond the rebase. Thanks for the review, and sorry for the lag on this!

@benthecarman
benthecarman merged commit 841490c into lightningdevkit:master Jul 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panic on same-mint melt: "Melt succeeded but no preimage" — internal settlement legitimately returns no preimage

2 participants