Problem
When finalizePendingMelts() completes a Lightning withdrawal at startup (after an app crash mid-melt), the transaction is saved correctly but without its invoice metadata. This happens because _pendingMeltInvoice is stored in memory only and is lost on app restart.
As a result, recovered melts appear as "Cashu send" instead of "Lightning withdrawal" in the transaction history.
Current behavior
1. User starts melt → _pendingMeltInvoice = invoice (in memory)
2. App crashes mid-melt
3. App restarts → _pendingMeltInvoice = null (memory cleared)
4. finalizePendingMelts() completes the melt successfully
5. _saveMeltMetadata() is never called (no invoice to save)
6. Transaction shows as "Cashu send" in history instead of "Lightning withdrawal"
Expected behavior
Recovered melts should show as "Lightning withdrawal" in history with the correct invoice, same as melts that complete normally.
Proposed solution
Persist pending melt data to SharedPreferences (similar to how _savePendingMintInvoice works for mint quotes), then reconcile after finalizePendingMelts()`:
- In
getMeltQuote(): save {quoteId, invoice, mintUrl, unit, amount} to SharedPreferences
- In
melt(): remove the entry on success (normal flow, no change needed)
- At startup after
finalizePendingMelts(): run a reconciliation that matches outgoing transactions without metadata to persisted melt entries and saves the correct TransactionType.lightning metadata
Impact
Cosmetic only — no fund loss. Transactions are completed correctly, just mislabeled in history.
Problem
When
finalizePendingMelts()completes a Lightning withdrawal at startup (after an app crash mid-melt), the transaction is saved correctly but without its invoice metadata. This happens because_pendingMeltInvoiceis stored in memory only and is lost on app restart.As a result, recovered melts appear as "Cashu send" instead of "Lightning withdrawal" in the transaction history.
Current behavior
Expected behavior
Recovered melts should show as "Lightning withdrawal" in history with the correct invoice, same as melts that complete normally.
Proposed solution
Persist pending melt data to SharedPreferences (similar to how
_savePendingMintInvoiceworks for mint quotes), then reconcile after finalizePendingMelts()`:getMeltQuote(): save{quoteId, invoice, mintUrl, unit, amount}to SharedPreferencesmelt(): remove the entry on success (normal flow, no change needed)finalizePendingMelts(): run a reconciliation that matches outgoing transactions without metadata to persisted melt entries and saves the correctTransactionType.lightningmetadataImpact
Cosmetic only — no fund loss. Transactions are completed correctly, just mislabeled in history.