mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-05 05:46:44 +00:00
fix exception on debug logging when sending from two or more utxos on the same derivation
This commit is contained in:
parent
4dd52eb9dd
commit
f2c2fc6071
1 changed files with 9 additions and 5 deletions
|
@ -838,12 +838,16 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
|
|
||||||
public void createTransaction(ActionEvent event) {
|
public void createTransaction(ActionEvent event) {
|
||||||
if(log.isDebugEnabled()) {
|
if(log.isDebugEnabled()) {
|
||||||
Map<WalletNode, String> nodeHashes = walletTransactionProperty.get().getSelectedUtxos().values().stream().collect(Collectors.toMap(Function.identity(), node -> ElectrumServer.getScriptHash(walletForm.getWallet(), node)));
|
Map<WalletNode, List<String>> inputHashes = new LinkedHashMap<>();
|
||||||
Map<WalletNode, String> changeHash = Collections.emptyMap();
|
for(WalletNode node : walletTransactionProperty.get().getSelectedUtxos().values()) {
|
||||||
if(walletTransactionProperty.get().getChangeNode() != null) {
|
List<String> nodeHashes = inputHashes.computeIfAbsent(node, k -> new ArrayList<>());
|
||||||
changeHash = Map.of(walletTransactionProperty.get().getChangeNode(), ElectrumServer.getScriptHash(walletForm.getWallet(), walletTransactionProperty.get().getChangeNode()));
|
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<WalletNode, List<String>> 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();
|
addWalletTransactionNodes();
|
||||||
|
|
Loading…
Reference in a new issue