From 9520f6d218e960b0c352aedc5b6c988ce7bc91cd Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Wed, 27 Oct 2021 12:01:04 +0200 Subject: [PATCH] upgrade to nightjar 0.2.19 (whirlpool client 0.23.37), minor tx diagram improvements --- build.gradle | 4 ++-- drongo | 2 +- .../sparrowwallet/sparrow/control/AddressCell.java | 2 +- .../com/sparrowwallet/sparrow/control/EntryCell.java | 2 +- .../sparrowwallet/sparrow/control/MixStatusCell.java | 12 +++++++----- .../sparrow/control/TransactionDiagram.java | 9 +++++---- .../com/sparrowwallet/sparrow/wallet/UtxoEntry.java | 6 ++++++ .../sparrowwallet/sparrow/whirlpool/Whirlpool.java | 2 +- 8 files changed, 24 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index 7c404445..38c361d2 100644 --- a/build.gradle +++ b/build.gradle @@ -91,7 +91,7 @@ dependencies { implementation('org.slf4j:jul-to-slf4j:1.7.30') { exclude group: 'org.slf4j' } - implementation('com.sparrowwallet.nightjar:nightjar:0.2.18-SNAPSHOT') + implementation('com.sparrowwallet.nightjar:nightjar:0.2.19') testImplementation('junit:junit:4.12') } @@ -449,7 +449,7 @@ extraJavaModuleInfo { module('cbor-0.9.jar', 'co.nstant.in.cbor', '0.9') { exports('co.nstant.in.cbor') } - module('nightjar-0.2.18-SNAPSHOT.jar', 'com.sparrowwallet.nightjar', '0.2.18-SNAPSHOT') { + module('nightjar-0.2.19.jar', 'com.sparrowwallet.nightjar', '0.2.19') { requires('com.google.common') requires('net.sourceforge.streamsupport') requires('org.slf4j') diff --git a/drongo b/drongo index 99440eda..24d9e5fc 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit 99440eda7f8a2b5a8adec68d32a704634157a3d3 +Subproject commit 24d9e5fcda84058c48964e2abe21600f61ec359d diff --git a/src/main/java/com/sparrowwallet/sparrow/control/AddressCell.java b/src/main/java/com/sparrowwallet/sparrow/control/AddressCell.java index d1112e38..28e007d8 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/AddressCell.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/AddressCell.java @@ -48,7 +48,7 @@ public class AddressCell extends TreeTableCell { } private String getTooltipText(UtxoEntry utxoEntry, boolean duplicate) { - return utxoEntry.getNode().getDerivationPath().replace("m", "..") + (duplicate ? " (Duplicate address)" : ""); + return utxoEntry.getNode().toString() + (duplicate ? " (Duplicate address)" : ""); } public static Glyph getDuplicateGlyph() { diff --git a/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java b/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java index 339b4fdc..61c7615e 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java @@ -106,7 +106,7 @@ public class EntryCell extends TreeTableCell { setText(address.toString()); setContextMenu(new AddressContextMenu(address, nodeEntry.getOutputDescriptor(), nodeEntry)); Tooltip tooltip = new Tooltip(); - tooltip.setText(nodeEntry.getNode().getDerivationPath().replace("m", "..")); + tooltip.setText(nodeEntry.getNode().toString()); setTooltip(tooltip); getStyleClass().add("address-cell"); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/MixStatusCell.java b/src/main/java/com/sparrowwallet/sparrow/control/MixStatusCell.java index 37aa35b0..cf9ca311 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/MixStatusCell.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/MixStatusCell.java @@ -18,6 +18,8 @@ import org.controlsfx.glyphfont.Glyph; import org.controlsfx.tools.Platform; public class MixStatusCell extends TreeTableCell { + private static final int ERROR_DISPLAY_MINUTES = 5; + public MixStatusCell() { super(); setAlignment(Pos.CENTER_RIGHT); @@ -46,7 +48,7 @@ public class MixStatusCell extends TreeTableCell { if(mixStatus.getNextMixUtxo() != null) { setMixSuccess(mixStatus.getNextMixUtxo()); } else if(mixStatus.getMixFailReason() != null) { - setMixFail(mixStatus.getMixFailReason(), mixStatus.getMixError()); + setMixFail(mixStatus.getMixFailReason(), mixStatus.getMixError(), mixStatus.getMixErrorTimestamp()); } else if(mixStatus.getMixProgress() != null) { setMixProgress(mixStatus.getUtxoEntry(), mixStatus.getMixProgress()); } else { @@ -65,10 +67,10 @@ public class MixStatusCell extends TreeTableCell { setTooltip(tt); } - private void setMixFail(MixFailReason mixFailReason, String mixError) { + private void setMixFail(MixFailReason mixFailReason, String mixError, Long mixErrorTimestamp) { if(mixFailReason != MixFailReason.CANCEL) { - if(getGraphic() != null && getGraphic().getUserData() == mixFailReason) { - //Fade transition already set + if(mixErrorTimestamp != null && System.currentTimeMillis() - mixErrorTimestamp > ERROR_DISPLAY_MINUTES * 60 * 1000) { + //Old error, don't set again. return; } @@ -81,7 +83,7 @@ public class MixStatusCell extends TreeTableCell { "\nTo prevent sleeping, use the " + getPlatformSleepConfig() + " or enable the function in the Tools menu."); setTooltip(tt); - FadeTransition ft = new FadeTransition(Duration.hours(1), failGlyph); + FadeTransition ft = new FadeTransition(Duration.minutes(ERROR_DISPLAY_MINUTES), failGlyph); ft.setFromValue(1); ft.setToValue(0); ft.setOnFinished(event -> { diff --git a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java index 280fe004..841fe01a 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java @@ -222,7 +222,7 @@ public class TransactionDiagram extends GridPane { Tooltip tooltip = new Tooltip(); if(walletNode != null) { - tooltip.setText("Spending " + getSatsValue(input.getValue()) + " sats from " + walletNode.getDerivationPath().replace("m", "..") + "\n" + input.getHashAsString() + ":" + input.getIndex() + "\n" + walletTx.getWallet().getAddress(walletNode)); + tooltip.setText("Spending " + getSatsValue(input.getValue()) + " sats from " + (isFinal() ? walletTx.getWallet().getFullName() : "") + " " + walletNode + "\n" + input.getHashAsString() + ":" + input.getIndex() + "\n" + walletTx.getWallet().getAddress(walletNode)); tooltip.getStyleClass().add("input-label"); if(input.getLabel() == null || input.getLabel().isEmpty()) { @@ -397,9 +397,10 @@ public class TransactionDiagram extends GridPane { recipientLabel.getStyleClass().add("output-label"); recipientLabel.getStyleClass().add(labelledPayment ? "payment-label" : "recipient-label"); Wallet toWallet = getToWallet(payment); - Tooltip recipientTooltip = new Tooltip((toWallet == null ? (walletTx.isConsolidationSend(payment) ? "Consolidate " : "Pay ") : "Receive ") + WalletNode toNode = walletTx.getWallet() != null ? walletTx.getWallet().getWalletAddresses().get(payment.getAddress()) : null; + Tooltip recipientTooltip = new Tooltip((toWallet == null ? (toNode != null ? "Consolidate " : "Pay ") : "Receive ") + getSatsValue(payment.getAmount()) + " sats to " - + (payment instanceof AdditionalPayment ? "\n" + payment : (toWallet == null ? (payment.getLabel() == null ? "external address" : payment.getLabel()) : toWallet.getName()) + "\n" + payment.getAddress().toString())); + + (payment instanceof AdditionalPayment ? "\n" + payment : (toWallet == null ? (payment.getLabel() == null ? (toNode != null ? toNode : "external address") : payment.getLabel()) : toWallet.getName()) + "\n" + payment.getAddress().toString())); recipientTooltip.getStyleClass().add("recipient-label"); recipientTooltip.setShowDelay(new Duration(TOOLTIP_SHOW_DELAY)); recipientLabel.setTooltip(recipientTooltip); @@ -416,7 +417,7 @@ public class TransactionDiagram extends GridPane { String changeDesc = changeAddress.toString().substring(0, 8) + "..."; Label changeLabel = new Label(changeDesc, overGapLimit ? getChangeWarningGlyph() : getChangeGlyph()); changeLabel.getStyleClass().addAll("output-label", "change-label"); - Tooltip changeTooltip = new Tooltip("Change of " + getSatsValue(changeEntry.getValue()) + " sats to " + changeNode.getDerivationPath().replace("m", "..") + "\n" + walletTx.getChangeAddress(changeNode).toString() + (overGapLimit ? "\nAddress is beyond the gap limit!" : "")); + Tooltip changeTooltip = new Tooltip("Change of " + getSatsValue(changeEntry.getValue()) + " sats to " + changeNode + "\n" + walletTx.getChangeAddress(changeNode).toString() + (overGapLimit ? "\nAddress is beyond the gap limit!" : "")); changeTooltip.getStyleClass().add("change-label"); changeTooltip.setShowDelay(new Duration(TOOLTIP_SHOW_DELAY)); changeLabel.setTooltip(changeTooltip); diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/UtxoEntry.java b/src/main/java/com/sparrowwallet/sparrow/wallet/UtxoEntry.java index a1ffe25f..1a0e0cfb 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/UtxoEntry.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/UtxoEntry.java @@ -128,6 +128,7 @@ public class UtxoEntry extends HashIndexEntry { private Utxo nextMixUtxo; private MixFailReason mixFailReason; private String mixError; + private Long mixErrorTimestamp; public MixStatus(MixProgress mixProgress) { this.mixProgress = mixProgress; @@ -140,6 +141,7 @@ public class UtxoEntry extends HashIndexEntry { public MixStatus(MixFailReason mixFailReason, String mixError) { this.mixFailReason = mixFailReason; this.mixError = mixError; + this.mixErrorTimestamp = System.currentTimeMillis(); } public UtxoEntry getUtxoEntry() { @@ -182,5 +184,9 @@ public class UtxoEntry extends HashIndexEntry { public String getMixError() { return mixError; } + + public Long getMixErrorTimestamp() { + return mixErrorTimestamp; + } } } diff --git a/src/main/java/com/sparrowwallet/sparrow/whirlpool/Whirlpool.java b/src/main/java/com/sparrowwallet/sparrow/whirlpool/Whirlpool.java index 0f679aff..73135136 100644 --- a/src/main/java/com/sparrowwallet/sparrow/whirlpool/Whirlpool.java +++ b/src/main/java/com/sparrowwallet/sparrow/whirlpool/Whirlpool.java @@ -173,7 +173,7 @@ public class Whirlpool { HD_WalletFactoryGeneric hdWalletFactory = HD_WalletFactoryGeneric.getInstance(); byte[] seed = hdWalletFactory.computeSeedFromWords(words); this.walletId = walletId; - hdWallet = new HD_Wallet(purpose, words, config.getNetworkParameters(), seed, passphrase, 10); + hdWallet = new HD_Wallet(purpose, words, config.getNetworkParameters(), seed, passphrase); } catch(Exception e) { throw new IllegalStateException("Could not create Whirlpool HD wallet ", e); }