From db478f8da606aec53882edbd15110d642c6b0fc5 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 19 May 2025 09:11:12 +0200 Subject: [PATCH] further followup tweaks --- .../sparrow/control/TransactionDiagram.java | 16 ++++++++-------- .../sparrow/wallet/SendController.java | 4 +++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java index b7510224..623fa920 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java @@ -227,9 +227,9 @@ public class TransactionDiagram extends GridPane { getChildren().clear(); getChildren().addAll(inputsTypePane, inputsPane, inputsLinesPane, txPane, outputsLinesPane, outputsPane); - List defaultPayments = getDefaultPayments(); - if(!isFinal() && defaultPayments.size() > 1) { - Pane totalsPane = getTotalsPane(defaultPayments); + List userPayments = getUserPayments(); + if(!isFinal() && userPayments.size() > 1) { + Pane totalsPane = getTotalsPane(userPayments); GridPane.setConstraints(totalsPane, 2, 0, 3, 1); getChildren().add(totalsPane); } @@ -621,8 +621,8 @@ public class TransactionDiagram extends GridPane { } } - private List getDefaultPayments() { - return walletTx.getPayments().stream().filter(payment -> payment.getType() == Payment.Type.DEFAULT).toList(); + private List getUserPayments() { + return walletTx.getPayments().stream().filter(payment -> payment.getType() == Payment.Type.DEFAULT || payment.getType() == Payment.Type.ANCHOR).toList(); } private Pane getOutputsLines(List displayedPayments) { @@ -848,18 +848,18 @@ public class TransactionDiagram extends GridPane { return txPane; } - private Pane getTotalsPane(List defaultPayments) { + private Pane getTotalsPane(List userPayments) { VBox totalsBox = new VBox(); totalsBox.setPadding(new Insets(0, 0, 15, 0)); totalsBox.setAlignment(Pos.CENTER); - long amount = defaultPayments.stream().mapToLong(Payment::getAmount).sum(); + long amount = userPayments.stream().mapToLong(Payment::getAmount).sum(); HBox coinLabelBox = new HBox(); coinLabelBox.setAlignment(Pos.CENTER); CoinLabel totalCoinLabel = new CoinLabel(); totalCoinLabel.setValue(amount); - coinLabelBox.getChildren().addAll(totalCoinLabel, new Label(" in "), new Label(Long.toString(defaultPayments.size())), new Label(" payments")); + coinLabelBox.getChildren().addAll(totalCoinLabel, new Label(" in "), new Label(Long.toString(userPayments.size())), new Label(" payments")); totalsBox.getChildren().addAll(createSpacer(), coinLabelBox); CurrencyRate currencyRate = AppServices.getFiatCurrencyExchangeRate(); diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java index 916290d7..f6e69f45 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java @@ -1625,7 +1625,9 @@ public class SendController extends WalletFormController implements Initializabl } else if(payjoinPresent) { addLabel("Cannot fake coinjoin due to payjoin", getInfoGlyph()); } else { - if(utxoSelectorProperty().get() != null && !(utxoSelectorProperty().get() instanceof MaxUtxoSelector)) { + if(utxoSelectorProperty().get() instanceof MaxUtxoSelector) { + addLabel("Cannot fake coinjoin with max amount selected", getInfoGlyph()); + } else if(utxoSelectorProperty().get() != null) { addLabel("Cannot fake coinjoin due to coin control", getInfoGlyph()); } else { addLabel("Cannot fake coinjoin due to insufficient funds", getInfoGlyph());