From d9ddc74d73285f9ef5aae7fa1b47010730ff6416 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 24 Oct 2022 08:18:17 +0200 Subject: [PATCH] disable rbf if allow unconfirmed preference is disabled --- .../sparrowwallet/sparrow/control/EntryCell.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java b/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java index def9ea7f..5522451f 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java @@ -9,7 +9,7 @@ import com.sparrowwallet.sparrow.AppServices; import com.sparrowwallet.sparrow.EventManager; import com.sparrowwallet.sparrow.event.*; import com.sparrowwallet.sparrow.glyphfont.FontAwesome5; -import com.sparrowwallet.sparrow.net.MempoolRateSize; +import com.sparrowwallet.sparrow.io.Config; import com.sparrowwallet.sparrow.wallet.*; import javafx.application.Platform; import javafx.geometry.Pos; @@ -96,7 +96,8 @@ public class EntryCell extends TreeTableCell { actionBox.getChildren().add(viewTransactionButton); BlockTransaction blockTransaction = transactionEntry.getBlockTransaction(); - if(blockTransaction.getHeight() <= 0 && blockTransaction.getTransaction().isReplaceByFee() && transactionEntry.getWallet().allInputsFromWallet(blockTransaction.getHash())) { + if(blockTransaction.getHeight() <= 0 && blockTransaction.getTransaction().isReplaceByFee() && + Config.get().isIncludeMempoolOutputs() && transactionEntry.getWallet().allInputsFromWallet(blockTransaction.getHash())) { Button increaseFeeButton = new Button(""); increaseFeeButton.setGraphic(getIncreaseFeeRBFGlyph()); increaseFeeButton.setOnAction(event -> { @@ -200,6 +201,12 @@ public class EntryCell extends TreeTableCell { .map(txInput -> walletTxos.keySet().stream().filter(txo -> txo.getHash().equals(txInput.getOutpoint().getHash()) && txo.getIndex() == txInput.getOutpoint().getIndex()).findFirst().get()) .collect(Collectors.toList()); + if(utxos.isEmpty()) { + log.error("No UTXOs to replace"); + AppServices.showErrorDialog("Replace By Fee Error", "Error creating RBF transaction - no replaceable UTXOs were found."); + return; + } + List ourOutputs = transactionEntry.getChildren().stream() .filter(e -> e instanceof HashIndexEntry) .map(e -> (HashIndexEntry)e) @@ -463,7 +470,7 @@ public class EntryCell extends TreeTableCell { }); getItems().add(viewTransaction); - if(blockTransaction.getTransaction().isReplaceByFee() && transactionEntry.getWallet().allInputsFromWallet(blockTransaction.getHash())) { + if(blockTransaction.getTransaction().isReplaceByFee() && Config.get().isIncludeMempoolOutputs() && transactionEntry.getWallet().allInputsFromWallet(blockTransaction.getHash())) { MenuItem increaseFee = new MenuItem("Increase Fee (RBF)"); increaseFee.setGraphic(getIncreaseFeeRBFGlyph()); increaseFee.setOnAction(AE -> {