mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-05 05:46:44 +00:00
fixes to minimum and pay then replace fee rates
This commit is contained in:
parent
205f78151a
commit
1d73956853
2 changed files with 12 additions and 2 deletions
|
@ -70,6 +70,8 @@ public enum FeeRatesSource {
|
||||||
blockTargetFeeRates.put(blockTarget, threeTierRates.halfHourFee);
|
blockTargetFeeRates.put(blockTarget, threeTierRates.halfHourFee);
|
||||||
} else if(blockTarget < BLOCKS_IN_TWO_HOURS || defaultblockTargetFeeRates.get(blockTarget) > threeTierRates.hourFee) {
|
} else if(blockTarget < BLOCKS_IN_TWO_HOURS || defaultblockTargetFeeRates.get(blockTarget) > threeTierRates.hourFee) {
|
||||||
blockTargetFeeRates.put(blockTarget, threeTierRates.hourFee);
|
blockTargetFeeRates.put(blockTarget, threeTierRates.hourFee);
|
||||||
|
} else if(threeTierRates.minimumFee != null && defaultblockTargetFeeRates.get(blockTarget) < threeTierRates.minimumFee) {
|
||||||
|
blockTargetFeeRates.put(blockTarget, threeTierRates.minimumFee + (threeTierRates.hourFee > threeTierRates.minimumFee ? threeTierRates.hourFee * 0.2 : 0.0));
|
||||||
} else {
|
} else {
|
||||||
blockTargetFeeRates.put(blockTarget, defaultblockTargetFeeRates.get(blockTarget));
|
blockTargetFeeRates.put(blockTarget, defaultblockTargetFeeRates.get(blockTarget));
|
||||||
}
|
}
|
||||||
|
|
|
@ -644,7 +644,7 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
Integer targetBlocks = getTargetBlocks(feeRateAmt);
|
Integer targetBlocks = getTargetBlocks(feeRateAmt);
|
||||||
if(targetBlocksFeeRates.get(Integer.MAX_VALUE) != null) {
|
if(targetBlocksFeeRates.get(Integer.MAX_VALUE) != null) {
|
||||||
Double minFeeRate = targetBlocksFeeRates.get(Integer.MAX_VALUE);
|
Double minFeeRate = targetBlocksFeeRates.get(Integer.MAX_VALUE);
|
||||||
if(minFeeRate > 1.0 && feeRateAmt <= minFeeRate) {
|
if(minFeeRate > 1.0 && feeRateAmt < minFeeRate) {
|
||||||
feeRatePriority.setText("Below Minimum");
|
feeRatePriority.setText("Below Minimum");
|
||||||
feeRatePriority.setTooltip(new Tooltip("Transactions at this fee rate are currently being purged from the default sized mempool"));
|
feeRatePriority.setTooltip(new Tooltip("Transactions at this fee rate are currently being purged from the default sized mempool"));
|
||||||
feeRatePriorityGlyph.setStyle("-fx-text-fill: #a0a1a7cc");
|
feeRatePriorityGlyph.setStyle("-fx-text-fill: #a0a1a7cc");
|
||||||
|
@ -653,7 +653,7 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
}
|
}
|
||||||
|
|
||||||
Double lowestBlocksRate = targetBlocksFeeRates.get(TARGET_BLOCKS_RANGE.get(TARGET_BLOCKS_RANGE.size() - 1));
|
Double lowestBlocksRate = targetBlocksFeeRates.get(TARGET_BLOCKS_RANGE.get(TARGET_BLOCKS_RANGE.size() - 1));
|
||||||
if(lowestBlocksRate > minFeeRate && feeRateAmt < (minFeeRate + ((lowestBlocksRate - minFeeRate) / 2))) {
|
if(lowestBlocksRate >= minFeeRate && feeRateAmt < (minFeeRate + ((lowestBlocksRate - minFeeRate) / 2)) && !isPayjoinTx()) {
|
||||||
feeRatePriority.setText("Try Then Replace");
|
feeRatePriority.setText("Try Then Replace");
|
||||||
feeRatePriority.setTooltip(new Tooltip("Send a transaction, verify it appears in the destination wallet, then RBF to get it confirmed or sent to another address"));
|
feeRatePriority.setTooltip(new Tooltip("Send a transaction, verify it appears in the destination wallet, then RBF to get it confirmed or sent to another address"));
|
||||||
feeRatePriorityGlyph.setStyle("-fx-text-fill: #7eb7c9cc");
|
feeRatePriorityGlyph.setStyle("-fx-text-fill: #7eb7c9cc");
|
||||||
|
@ -691,6 +691,14 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isPayjoinTx() {
|
||||||
|
if(walletTransactionProperty.get() != null) {
|
||||||
|
return walletTransactionProperty.get().getPayments().stream().anyMatch(payment -> AppServices.getPayjoinURI(payment.getAddress()) != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private Node getSliderThumb() {
|
private Node getSliderThumb() {
|
||||||
return targetBlocks.lookup(".thumb");
|
return targetBlocks.lookup(".thumb");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue