From 1274d56fce59dbd5b9aa493959c44e49ba1df13b Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Fri, 19 Mar 2021 13:35:59 +0200 Subject: [PATCH] ensure fees decrease as target blocks increase, show priority on target blocks slider track --- .../java/com/sparrowwallet/sparrow/net/FeeRatesSource.java | 6 ++++++ .../resources/com/sparrowwallet/sparrow/wallet/send.css | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/main/java/com/sparrowwallet/sparrow/net/FeeRatesSource.java b/src/main/java/com/sparrowwallet/sparrow/net/FeeRatesSource.java index 27d80e69..487d8a82 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/FeeRatesSource.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/FeeRatesSource.java @@ -63,6 +63,7 @@ public enum FeeRatesSource { try(InputStream is = (proxy == null ? new URL(url).openStream() : new URL(url).openConnection(proxy).getInputStream()); Reader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) { Gson gson = new Gson(); ThreeTierRates threeTierRates = gson.fromJson(reader, ThreeTierRates.class); + Double lastRate = null; for(Integer blockTarget : defaultblockTargetFeeRates.keySet()) { if(blockTarget < BLOCKS_IN_HALF_HOUR) { blockTargetFeeRates.put(blockTarget, threeTierRates.fastestFee); @@ -75,6 +76,11 @@ public enum FeeRatesSource { } else { blockTargetFeeRates.put(blockTarget, defaultblockTargetFeeRates.get(blockTarget)); } + + if(lastRate != null) { + blockTargetFeeRates.put(blockTarget, Math.min(lastRate, blockTargetFeeRates.get(blockTarget))); + } + lastRate = blockTargetFeeRates.get(blockTarget); } if(threeTierRates.minimumFee != null) { diff --git a/src/main/resources/com/sparrowwallet/sparrow/wallet/send.css b/src/main/resources/com/sparrowwallet/sparrow/wallet/send.css index de173ac1..920d0b75 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/wallet/send.css +++ b/src/main/resources/com/sparrowwallet/sparrow/wallet/send.css @@ -104,3 +104,10 @@ #transactionDiagram .utxo-label:hover .button .label .text { -fx-fill: -fx-text-base-color; } + +#targetBlocks .track { + -fx-background-color: -fx-shadow-highlight-color, + linear-gradient(to bottom, derive(-fx-text-box-border, -10%), -fx-text-box-border), + linear-gradient(to bottom, derive(-fx-control-inner-background, -9%), derive(-fx-control-inner-background, 0%), derive(-fx-control-inner-background, -5%), derive(-fx-control-inner-background, -12%)), + linear-gradient(to right, #c8416466 0%, #a0a1a766 50%, #a0a1a700 100%); +} \ No newline at end of file