payjoin: exclude 0-conf inputs from receiver candidates (#3389)
Cindy committed
Jul 10, 2026 at 12:23 UTC
43bc0b67bf4c89b1f1d11eee416febcf62be0a50
2 files changed
+4
-4
cw_bitcoin/lib/bitcoin_wallet.dart
+2
-2
@@ -551,8 +551,8 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
551
return tx;
552
}
553
554
- List<UtxoWithPrivateKey> getUtxoWithPrivateKeys() => unspentCoins
555
- .where((e) => (e.isSending && !e.isFrozen))
554
+ List<UtxoWithPrivateKey> getUtxoWithPrivateKeys({bool confirmedOnly = false}) => unspentCoins
555
+ .where((e) => e.isSending && !e.isFrozen && (!confirmedOnly || (e.confirmations ?? 0) > 0))
556
.map((unspent) => UtxoWithPrivateKey.fromUnspent(unspent, this))
557
.toList();
558
cw_bitcoin/lib/payjoin/manager.dart
+2
-2
@@ -297,10 +297,10 @@ class PayjoinManager {
297
break;
298
299
case PayjoinReceiverRequestTypes.getCandidateInputs:
300
- utxos = _wallet.getUtxoWithPrivateKeys();
300
+ utxos = _wallet.getUtxoWithPrivateKeys(confirmedOnly: true);
301
if (utxos.isEmpty) {
302
await _wallet.updateAllUnspents();
303
- utxos = _wallet.getUtxoWithPrivateKeys();
303
+ utxos = _wallet.getUtxoWithPrivateKeys(confirmedOnly: true);
304
}
305
mainToIsolateSendPort?.send({
306
'requestId': message['requestId'],