diff --git a/drongo b/drongo index f1068827..b4b2534e 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit f10688279a7a761c734c80c051237c0a4a90928b +Subproject commit b4b2534e7a69c272a4d8b089cd88b3502f6d4b39 diff --git a/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java b/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java index 49597b1f..13f6dde8 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java @@ -373,11 +373,11 @@ public class EntryCell extends TreeTableCell { private String getTooltip(TransactionEntry transactionEntry) { String tooltip = transactionEntry.getBlockTransaction().getHash().toString(); if(transactionEntry.getBlockTransaction().getHeight() <= 0) { - if(!AppServices.getMempoolHistogram().isEmpty()) { - Set rateSizes = AppServices.getMempoolHistogram().get(AppServices.getMempoolHistogram().lastKey()); - double vSize = transactionEntry.getBlockTransaction().getTransaction().getVirtualSize(); - double feeRate = transactionEntry.getBlockTransaction().getFee() / vSize; - long vSizefromTip = rateSizes.stream().filter(rateSize -> rateSize.getFee() > feeRate).mapToLong(MempoolRateSize::getVSize).sum(); + Double feeRate = transactionEntry.getBlockTransaction().getFeeRate(); + Long vSizefromTip = transactionEntry.getVSizeFromTip(); + if(feeRate != null && vSizefromTip != null) { + long blocksFromTip = (long)Math.ceil((double)vSizefromTip / Transaction.MAX_BLOCK_SIZE); + String amount = vSizefromTip + " vB"; if(vSizefromTip > 1000 * 1000) { amount = String.format("%.2f", (double)vSizefromTip / (1000 * 1000)) + " MvB"; @@ -385,7 +385,11 @@ public class EntryCell extends TreeTableCell { amount = String.format("%.2f", (double)vSizefromTip / 1000) + " kvB"; } - tooltip += "\nFee rate: " + String.format("%.2f", feeRate) + " sats/vB (" + amount + " from tip)"; + tooltip += "\nConfirms in: ±" + blocksFromTip + " block" + (blocksFromTip > 1 ? "s" : "") + " (" + amount + " from tip)"; + } + + if(feeRate != null) { + tooltip += "\nFee rate: " + String.format("%.2f", feeRate) + " sats/vB"; } tooltip += "\nRBF: " + (transactionEntry.getBlockTransaction().getTransaction().isReplaceByFee() ? "Enabled" : "Disabled"); diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/TransactionEntry.java b/src/main/java/com/sparrowwallet/sparrow/wallet/TransactionEntry.java index 7ee0e4f4..e47a6337 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/TransactionEntry.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/TransactionEntry.java @@ -12,6 +12,7 @@ import com.sparrowwallet.sparrow.WalletTabData; import com.sparrowwallet.sparrow.event.WalletBlockHeightChangedEvent; import com.sparrowwallet.sparrow.event.WalletEntryLabelsChangedEvent; import com.sparrowwallet.sparrow.event.WalletTabsClosedEvent; +import com.sparrowwallet.sparrow.net.MempoolRateSize; import javafx.beans.property.IntegerProperty; import javafx.beans.property.IntegerPropertyBase; import javafx.beans.property.LongProperty; @@ -181,9 +182,12 @@ public class TransactionEntry extends Entry implements Comparable rateSizes = AppServices.getMempoolHistogram().get(AppServices.getMempoolHistogram().lastKey()); + double feeRate = blockTransaction.getFeeRate(); + return rateSizes.stream().filter(rateSize -> rateSize.getFee() > feeRate).mapToLong(MempoolRateSize::getVSize).sum(); + } + + return null; + } + @Subscribe public void blockHeightChanged(WalletBlockHeightChangedEvent event) { if(event.getWallet().equals(getWallet())) { diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/WalletTransactionsEntry.java b/src/main/java/com/sparrowwallet/sparrow/wallet/WalletTransactionsEntry.java index c3363fbe..2a9b994e 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/WalletTransactionsEntry.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/WalletTransactionsEntry.java @@ -246,9 +246,11 @@ public class WalletTransactionsEntry extends Entry { @Override public int compareTo(WalletTransactionsEntry.WalletTransaction other) { //This comparison must be identical to that of TransactionEntry so we can avoid a resort calculating balances when creating WalletTransactionsEntry - int blockOrder = blockTransaction.compareBlockOrder(other.blockTransaction); - if(blockOrder != 0) { - return blockOrder; + if(blockTransaction.getHeight() != other.blockTransaction.getHeight()) { + int blockOrder = blockTransaction.getComparisonHeight() - other.blockTransaction.getComparisonHeight(); + if(blockOrder != 0) { + return blockOrder; + } } int valueOrder = Long.compare(other.getValue(), getValue()); @@ -256,7 +258,7 @@ public class WalletTransactionsEntry extends Entry { return valueOrder; } - return blockTransaction.compareTo(other.blockTransaction); + return blockTransaction.getHash().compareTo(other.blockTransaction.getHash()); } } }