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; tx0Previews = null;
tx0PreviewProperty.set(null); tx0PreviewProperty.set(null);
Tx0FeeTarget tx0FeeTarget = FEE_TARGETS.get(newValue.intValue()); 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); premixPriority.setValue(1);

View file

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

View file

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

View file

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