From 486027f153b0cb5d12cc1f045f021ac950de5943 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Thu, 14 Jul 2022 13:42:14 +0200 Subject: [PATCH] use address node map to optimize transaction diagram and privacy analysis --- .../com/sparrowwallet/sparrow/control/TransactionDiagram.java | 2 +- .../java/com/sparrowwallet/sparrow/wallet/SendController.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java index 9649e213..337241bc 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java @@ -659,7 +659,7 @@ public class TransactionDiagram extends GridPane { recipientLabel.getStyleClass().add("output-label"); recipientLabel.getStyleClass().add(labelledPayment ? "payment-label" : "recipient-label"); Wallet toWallet = getToWallet(payment); - WalletNode toNode = walletTx.getWallet() != null && !walletTx.getWallet().isBip47() ? walletTx.getWallet().getWalletAddresses().get(payment.getAddress()) : null; + WalletNode toNode = walletTx.getWallet() != null && !walletTx.getWallet().isBip47() ? walletTx.getAddressNodeMap(walletTx.getWallet()).get(payment.getAddress()) : null; Wallet toBip47Wallet = getBip47SendWallet(payment); Tooltip recipientTooltip = new Tooltip((toWallet == null ? (toNode != null ? "Consolidate " : "Pay ") : "Receive ") + getSatsValue(payment.getAmount()) + " sats to " diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java index 6f60cb24..91e8af58 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java @@ -1639,7 +1639,7 @@ public class SendController extends WalletFormController implements Initializabl public PrivacyAnalysisTooltip(WalletTransaction walletTransaction) { List payments = walletTransaction.getPayments(); List userPayments = payments.stream().filter(payment -> payment.getType() != Payment.Type.FAKE_MIX).collect(Collectors.toList()); - Map walletAddresses = getWalletForm().getWallet().getWalletAddresses(); + Map walletAddresses = walletTransaction.getAddressNodeMap(walletTransaction.getWallet()); OptimizationStrategy optimizationStrategy = getPreferredOptimizationStrategy(); boolean payNymPresent = isPayNymMixOnlyPayment(payments); boolean fakeMixPresent = payments.stream().anyMatch(payment -> payment.getType() == Payment.Type.FAKE_MIX);