fix: run mint-quote recovery before checkAllMintQuotes

This commit is contained in:
Forte11Cuba
2026-04-19 06:18:51 -06:00
parent dd9450c0cc
commit 73a0261af6
+10 -4
View File
@@ -1836,6 +1836,13 @@ class WalletProvider extends ChangeNotifier {
/// Llamar en background al iniciar la app.
/// También vincula transacciones incoming sin metadata con invoices pendientes.
Future<void> checkPendingTransactions() async {
// Recover paid-but-unissued quotes by quote_id FIRST, before the
// per-mint loop runs checkAllMintQuotes. CDK's mint_unissued_quotes
// issues proofs silently (drops amount_issued > 0 into the quote,
// excluding it from the unissued list), so if it ran first our
// recovery would find nothing and bolt11 metadata would be lost.
await _recoverPendingMintQuotes();
// Iterar todos los mints y todas sus unidades, no solo los wallets
// ya instanciados. initialize() solo precarga units.first por mint,
// así que quotes/sagas/melts en otras unidades se perderían.
@@ -1845,7 +1852,9 @@ class WalletProvider extends ChangeNotifier {
final wallet = await getWallet(entry.key, unit);
try {
// Reclamar quotes pagados pero no emitidos (Lightning → proofs)
// Safety net: after our recovery pass, this should be a no-op
// for healthy cases. Still useful if _recoverPendingMintQuotes
// errored on a specific quote and CDK can retry issuance.
await wallet.checkAllMintQuotes();
} catch (e) {
debugPrint('Check mint quotes failed: $e');
@@ -1878,9 +1887,6 @@ class WalletProvider extends ChangeNotifier {
}
}
// Recover paid-but-unissued quotes by quote_id (exact, no heuristics)
await _recoverPendingMintQuotes();
// Resume pending Nostr payment request if app was killed mid-wait
await resumePendingNostrRequest();
}