increase recent blocks estimated fee rate update frequency

This commit is contained in:
Craig Raw 2025-05-21 15:38:06 +02:00
parent 63c0a6d6e2
commit 098afebbe0
2 changed files with 9 additions and 0 deletions

View file

@ -17,8 +17,10 @@ import javafx.util.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import static com.sparrowwallet.sparrow.AppServices.TARGET_BLOCKS_RANGE;
import static com.sparrowwallet.sparrow.control.BlockCube.CUBE_SIZE;
public class RecentBlocksView extends Pane {
@ -136,6 +138,12 @@ public class RecentBlocksView extends Pane {
}
}
public void updateFeeRate(Map<Integer, Double> targetBlockFeeRates) {
int defaultTarget = TARGET_BLOCKS_RANGE.get((TARGET_BLOCKS_RANGE.size() / 2) - 1);
Double defaultRate = targetBlockFeeRates.get(defaultTarget);
updateFeeRate(defaultRate);
}
public void updateFeeRate(Double currentFeeRate) {
if(!getCubes().isEmpty()) {
BlockCube firstCube = getCubes().getFirst();

View file

@ -1411,6 +1411,7 @@ public class SendController extends WalletFormController implements Initializabl
setFeeRatePriority(getFeeRangeRate());
}
feeRange.updateTrackHighlight();
recentBlocksView.updateFeeRate(event.getTargetBlockFeeRates());
if(updateDefaultFeeRate) {
if(getFeeRate() != null && Long.valueOf((long)getFallbackFeeRate()).equals(getFeeRate().longValue())) {