From dfc10f5f7edbc5da42c0e3cbe532f2846948fd74 Mon Sep 17 00:00:00 2001 From: Paperclip Deployment Engineer Date: Thu, 16 Jul 2026 07:22:12 +0000 Subject: [PATCH] fix: exclude failed mint from fallback candidate selection When routstr.otrta.me rejects a Cashu token with 'mint_unreachable', the mint fallback handler calls _spendToken with a fallback mint URL (e.g. cubabitcoin.org). However, _spendToken's internal _selectCandidateMints puts the highest-balance mint first regardless of the preferredMintUrl parameter, so the fallback token was still minted from the same unreachable mint (minibits). Pass excludeMints: [initialMintUrl] to _spendToken so the failed mint is excluded from candidate selection, forcing the fallback to use the requested alternative mint. --- src/daemon/wallet/sdk-mint-fallback.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/daemon/wallet/sdk-mint-fallback.ts b/src/daemon/wallet/sdk-mint-fallback.ts index 387c690..13d6bf3 100644 --- a/src/daemon/wallet/sdk-mint-fallback.ts +++ b/src/daemon/wallet/sdk-mint-fallback.ts @@ -177,6 +177,7 @@ export function installMintUnreachableErrorRetry( mintUrl, amount: params.requiredSats, baseUrl, + excludeMints: [initialMintUrl], }); const retryToken = spendResult.token;