Skip to content

Commit 5a43c3e

Browse files
author
talgya
committed
Don't panic when a same-mint melt settles without a preimage
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 #91.
1 parent 5a540f6 commit 5a43c3e

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

  • orange-sdk/src/trusted_wallet/cashu

orange-sdk/src/trusted_wallet/cashu/mod.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -730,15 +730,17 @@ impl Cashu {
730730
},
731731
},
732732
None => {
733-
debug_assert!(
734-
false,
735-
"Melt succeeded but no preimage for quote: {quote_id}"
736-
);
737-
log_error!(
733+
// Expected for same-mint payments: when the melt's
734+
// bolt11 destination is a mint quote on this same
735+
// mint, cdk-mintd settles internally — no Lightning
736+
// payment occurs, so there is no preimage to return.
737+
// The success path below already tolerates None
738+
// (hash falls back to the invoice payment_hash).
739+
log_info!(
738740
logger,
739-
"Melt succeeded but no preimage for quote: {quote_id}"
741+
"Melt for quote {quote_id} settled without a preimage (internal/same-mint settlement)"
740742
);
741-
None // Placeholder, should not happen
743+
None
742744
},
743745
};
744746

0 commit comments

Comments
 (0)