@@ -382,6 +382,7 @@ public Double fromString(String string) {
382
382
});
383
383
384
384
walletTransactionProperty .addListener ((observable , oldValue , walletTransaction ) -> {
385
+ setEffectiveFeeRate (walletTransaction );
385
386
if (walletTransaction != null ) {
386
387
setPayments (walletTransaction .getPayments ().stream ().filter (payment -> payment .getType () != Payment .Type .FAKE_MIX ).collect (Collectors .toList ()));
387
388
@@ -395,7 +396,6 @@ public Double fromString(String string) {
395
396
}
396
397
397
398
setFeeRate (feeRate );
398
- setEffectiveFeeRate (walletTransaction );
399
399
}
400
400
401
401
transactionDiagram .update (walletTransaction );
@@ -881,22 +881,27 @@ public boolean isInsufficientFeeRate() {
881
881
882
882
private void setFeeRate (Double feeRateAmt ) {
883
883
UnitFormat format = Config .get ().getUnitFormat () == null ? UnitFormat .DOT : Config .get ().getUnitFormat ();
884
- feeRate .setText (format .getCurrencyFormat ().format (feeRateAmt ) + " sats/vB" );
884
+ feeRate .setText (format .getCurrencyFormat ().format (feeRateAmt ) + ( cpfpFeeRate . isVisible () ? "" : " sats/vB") );
885
885
setFeeRatePriority (feeRateAmt );
886
886
}
887
887
888
888
private void setEffectiveFeeRate (WalletTransaction walletTransaction ) {
889
- List <BlockTransaction > unconfirmedUtxoTxs = walletTransaction .getSelectedUtxos ().keySet ().stream ().filter (ref -> ref .getHeight () <= 0 )
890
- .map (ref -> getWalletForm ().getWallet ().getWalletTransaction (ref .getHash ())).filter (Objects ::nonNull ).distinct ().collect (Collectors .toList ());
889
+ List <BlockTransaction > unconfirmedUtxoTxs = walletTransaction == null ? Collections .emptyList () :
890
+ walletTransaction .getSelectedUtxos ().keySet ().stream ().filter (ref -> ref .getHeight () <= 0 )
891
+ .map (ref -> getWalletForm ().getWallet ().getWalletTransaction (ref .getHash ()))
892
+ .filter (Objects ::nonNull ).distinct ().collect (Collectors .toList ());
891
893
if (!unconfirmedUtxoTxs .isEmpty ()) {
892
894
long utxoTxFee = unconfirmedUtxoTxs .stream ().mapToLong (BlockTransaction ::getFee ).sum ();
893
895
double utxoTxSize = unconfirmedUtxoTxs .stream ().mapToDouble (blkTx -> blkTx .getTransaction ().getVirtualSize ()).sum ();
894
896
long thisFee = walletTransaction .getFee ();
895
897
double thisSize = walletTransaction .getTransaction ().getVirtualSize ();
896
898
double effectiveRate = (utxoTxFee + thisFee ) / (utxoTxSize + thisSize );
897
- Tooltip tooltip = new Tooltip ("Child Pays For Parent\n " + String .format ("%.2f" , effectiveRate ) + " sats/vB effective rate" );
899
+ UnitFormat format = Config .get ().getUnitFormat () == null ? UnitFormat .DOT : Config .get ().getUnitFormat ();
900
+ String strEffectiveRate = format .getCurrencyFormat ().format (effectiveRate );
901
+ Tooltip tooltip = new Tooltip ("CPFP (Child Pays For Parent)\n " + strEffectiveRate + " sats/vB effective rate" );
898
902
cpfpFeeRate .setTooltip (tooltip );
899
903
cpfpFeeRate .setVisible (true );
904
+ cpfpFeeRate .setText (strEffectiveRate + " sats/vB (CPFP)" );
900
905
} else {
901
906
cpfpFeeRate .setVisible (false );
902
907
}
@@ -1548,6 +1553,7 @@ public void bitcoinUnitChanged(BitcoinUnitChangedEvent event) {
1548
1553
1549
1554
@ Subscribe
1550
1555
public void unitFormatChanged (UnitFormatChangedEvent event ) {
1556
+ setEffectiveFeeRate (getWalletTransaction ());
1551
1557
setFeeRate (getFeeRate ());
1552
1558
if (fee .getTextFormatter () instanceof CoinTextFormatter coinTextFormatter && coinTextFormatter .getUnitFormat () != event .getUnitFormat ()) {
1553
1559
Long value = getFeeValueSats (coinTextFormatter .getUnitFormat (), feeAmountUnit .getSelectionModel ().getSelectedItem ());
0 commit comments