follow up

This commit is contained in:
Craig Raw 2021-10-22 11:19:26 +02:00
parent 1497b3d3bb
commit 26c177bd00
4 changed files with 14 additions and 9 deletions

View file

@ -139,7 +139,7 @@ public class WhirlpoolController {
tx0Previews = null;
tx0PreviewProperty.set(null);
Tx0FeeTarget tx0FeeTarget = FEE_TARGETS.get(newValue.intValue());
premixFeeRate.setText(SparrowMinerFeeSupplier.getMinimumFeeForTarget(Integer.parseInt(tx0FeeTarget.getFeeTarget().getValue())) + " sats/vB");
premixFeeRate.setText(SparrowMinerFeeSupplier.getFee(Integer.parseInt(tx0FeeTarget.getFeeTarget().getValue())) + " sats/vB");
});
premixPriority.setValue(1);

View file

@ -26,13 +26,18 @@ public class SparrowMinerFeeSupplier implements MinerFeeSupplier {
@Override
public int getFee(MinerFeeTarget feeTarget) {
if (AppServices.getTargetBlockFeeRates() == null) {
return FALLBACK_FEE_RATE;
}
return getMinimumFeeForTarget(Integer.parseInt(feeTarget.getValue()));
return getFee(Integer.parseInt(feeTarget.getValue()));
}
public static Integer getMinimumFeeForTarget(int targetBlocks) {
public static int getFee(int targetBlocks) {
if(AppServices.getTargetBlockFeeRates() == null) {
return FALLBACK_FEE_RATE;
}
return getMinimumFeeForTarget(targetBlocks);
}
private static Integer getMinimumFeeForTarget(int targetBlocks) {
List<Map.Entry<Integer, Double>> feeRates = new ArrayList<>(AppServices.getTargetBlockFeeRates().entrySet());
Collections.reverse(feeRates);
for(Map.Entry<Integer, Double> feeRate : feeRates) {

View file

@ -38,9 +38,9 @@
}
.field-label {
-fx-pref-width: 120px;
-fx-pref-width: 130px;
}
.field-control {
-fx-pref-width: 160px;
-fx-pref-width: 180px;
}

View file

@ -92,7 +92,7 @@
<Insets top="20" />
</padding>
<Label text="SCODE:" styleClass="field-label" />
<TextField fx:id="scode" />
<TextField fx:id="scode" styleClass="field-control"/>
</HBox>
<HBox styleClass="field-box">
<padding>