From a5312374a85f4adcb8f4f649f682ca9367a39b33 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 13 Nov 2023 14:37:41 +0200 Subject: [PATCH] show error dialog on cpfp if no outputs are spendable --- .../java/com/sparrowwallet/sparrow/control/EntryCell.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java b/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java index cb2472ab..47432ec2 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java @@ -352,12 +352,14 @@ public class EntryCell extends TreeTableCell implements Confirmati List ourOutputs = transactionEntry.getChildren().stream() .filter(e -> e instanceof HashIndexEntry) .map(e -> (HashIndexEntry)e) - .filter(e -> e.getType().equals(HashIndexEntry.Type.OUTPUT)) + .filter(e -> e.getType().equals(HashIndexEntry.Type.OUTPUT) && e.isSpendable()) .map(HashIndexEntry::getHashIndex) .collect(Collectors.toList()); if(ourOutputs.isEmpty()) { - throw new IllegalStateException("Cannot create CPFP without any wallet outputs to spend"); + AppServices.showErrorDialog("No spendable outputs", "None of the outputs on this transaction are spendable.\n\n Ensure that the outputs are not frozen" + + (transactionEntry.getConfirmations() <= 0 ? ", and spending unconfirmed UTXOs is allowed." : ".")); + return; } BlockTransactionHashIndex cpfpUtxo = ourOutputs.get(0);