Skip to content

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

Description

@hash-money

Summary

When a Cashu melt's bolt11 destination is a mint quote on the same mint, cdk-mintd settles it internally — no Lightning payment occurs, so the melt result carries no payment_preimage. trusted_wallet/cashu/mod.rs (rev 4e9d230) expect()s a preimage on the success path and panics:

thread 'tokio-rt-worker' panicked at .../orange-sdk/src/trusted_wallet/cashu/mod.rs:
Melt succeeded but no preimage for quote: 80876079-f874-4735-a987-ae4277417d29

Repro

Two wallets on the same mint (cdk-mintd 0.16). Wallet A holds trusted (Cashu) balance; wallet B creates a bolt11 mint quote; A pays B's invoice via pay()'s melt path (amount ≤ A's trusted balance). The mint marks B's quote paid via internal settlement (attempt_internal_settlement in cdk's melt saga) and returns the melt as PAID with payment_preimage: None. A panics.

Funds are safe — the melt has settled and the receiver mints normally — but the sender process dies mid-send. On mobile (UniFFI) the unwind across the FFI boundary aborts the app, so any user paying another user of the same mint from their trusted balance hard-crashes.

Expected

A PAID melt without a preimage is legitimate (NUT-05 marks the preimage optional; internal settlement is the canonical case). The success path should emit PaymentSuccessful with payment_preimage: None instead of unwrapping.

Observed 2026-07-11 on signet (self-hosted cdk-mintd, Mutinynet). Downstream report with logs: emergent-money/graduated-wallet#374. Note this path is exercised by orange-sdk's own model: any wallet whose trusted float covers the payment amount and whose payee shares its mint takes it — it's the expected flow for small payments between users of one mint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions