mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
fix npe configuring recent blocks view on new installs
This commit is contained in:
parent
098afebbe0
commit
853949675e
2 changed files with 13 additions and 4 deletions
|
|
@ -52,7 +52,10 @@ public class BlockCube extends Group {
|
||||||
public BlockCube(Integer weight, Double medianFee, Integer height, Integer txCount, Long timestamp, boolean confirmed) {
|
public BlockCube(Integer weight, Double medianFee, Integer height, Integer txCount, Long timestamp, boolean confirmed) {
|
||||||
getStyleClass().addAll("block-" + Network.getCanonical().getName(), "block-cube");
|
getStyleClass().addAll("block-" + Network.getCanonical().getName(), "block-cube");
|
||||||
this.confirmedProperty.set(confirmed);
|
this.confirmedProperty.set(confirmed);
|
||||||
this.feeRatesSource.set(Config.get().getFeeRatesSource());
|
|
||||||
|
FeeRatesSource feeRatesSource = Config.get().getFeeRatesSource();
|
||||||
|
feeRatesSource = (feeRatesSource == null ? FeeRatesSource.MEMPOOL_SPACE : feeRatesSource);
|
||||||
|
this.feeRatesSource.set(feeRatesSource);
|
||||||
|
|
||||||
this.weightProperty.addListener((_, _, _) -> {
|
this.weightProperty.addListener((_, _, _) -> {
|
||||||
if(front != null) {
|
if(front != null) {
|
||||||
|
|
@ -198,6 +201,8 @@ public class BlockCube extends Group {
|
||||||
} else {
|
} else {
|
||||||
feeRateIcon.getChildren().clear();
|
feeRateIcon.getChildren().clear();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
feeRateIcon.getChildren().clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,9 @@ public class RecentBlocksView extends Pane {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
updateFeeRatesSource(Config.get().getFeeRatesSource());
|
FeeRatesSource feeRatesSource = Config.get().getFeeRatesSource();
|
||||||
|
feeRatesSource = (feeRatesSource == null ? FeeRatesSource.MEMPOOL_SPACE : feeRatesSource);
|
||||||
|
updateFeeRatesSource(feeRatesSource);
|
||||||
Tooltip.install(this, tooltip);
|
Tooltip.install(this, tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -140,8 +142,10 @@ public class RecentBlocksView extends Pane {
|
||||||
|
|
||||||
public void updateFeeRate(Map<Integer, Double> targetBlockFeeRates) {
|
public void updateFeeRate(Map<Integer, Double> targetBlockFeeRates) {
|
||||||
int defaultTarget = TARGET_BLOCKS_RANGE.get((TARGET_BLOCKS_RANGE.size() / 2) - 1);
|
int defaultTarget = TARGET_BLOCKS_RANGE.get((TARGET_BLOCKS_RANGE.size() / 2) - 1);
|
||||||
Double defaultRate = targetBlockFeeRates.get(defaultTarget);
|
if(targetBlockFeeRates.get(defaultTarget) != null) {
|
||||||
updateFeeRate(defaultRate);
|
Double defaultRate = targetBlockFeeRates.get(defaultTarget);
|
||||||
|
updateFeeRate(defaultRate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateFeeRate(Double currentFeeRate) {
|
public void updateFeeRate(Double currentFeeRate) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue