diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java index 778e6152..5d9cec4f 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java @@ -838,12 +838,16 @@ public class SendController extends WalletFormController implements Initializabl public void createTransaction(ActionEvent event) { if(log.isDebugEnabled()) { - Map nodeHashes = walletTransactionProperty.get().getSelectedUtxos().values().stream().collect(Collectors.toMap(Function.identity(), node -> ElectrumServer.getScriptHash(walletForm.getWallet(), node))); - Map changeHash = Collections.emptyMap(); - if(walletTransactionProperty.get().getChangeNode() != null) { - changeHash = Map.of(walletTransactionProperty.get().getChangeNode(), ElectrumServer.getScriptHash(walletForm.getWallet(), walletTransactionProperty.get().getChangeNode())); + Map> inputHashes = new LinkedHashMap<>(); + for(WalletNode node : walletTransactionProperty.get().getSelectedUtxos().values()) { + List nodeHashes = inputHashes.computeIfAbsent(node, k -> new ArrayList<>()); + nodeHashes.add(ElectrumServer.getScriptHash(walletForm.getWallet(), node)); } - log.debug("Creating tx " + walletTransactionProperty.get().getTransaction().getTxId() + ", expecting notifications for \ninputs \n" + nodeHashes + " and \nchange \n" + changeHash); + Map> changeHash = Collections.emptyMap(); + if(walletTransactionProperty.get().getChangeNode() != null) { + changeHash = Map.of(walletTransactionProperty.get().getChangeNode(), List.of(ElectrumServer.getScriptHash(walletForm.getWallet(), walletTransactionProperty.get().getChangeNode()))); + } + log.debug("Creating tx " + walletTransactionProperty.get().getTransaction().getTxId() + ", expecting notifications for \ninputs \n" + inputHashes + " and \nchange \n" + changeHash); } addWalletTransactionNodes();