mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-04 21:36:45 +00:00
use whirlpool premix priority slider to change mixfeetarget, display warning if chosen fee rate is much lower than normal priority
This commit is contained in:
parent
3bc7c7473a
commit
98b33e184e
4 changed files with 29 additions and 2 deletions
|
@ -197,6 +197,7 @@ public class MixPoolDialog extends WalletDialog {
|
|||
tx0Previews = null;
|
||||
whirlpool.setScode(mixConfig.getScode());
|
||||
whirlpool.setTx0FeeTarget(tx0FeeTarget);
|
||||
whirlpool.setMixFeeTarget(tx0FeeTarget);
|
||||
|
||||
Whirlpool.Tx0PreviewsService tx0PreviewsService = new Whirlpool.Tx0PreviewsService(whirlpool, utxoEntries);
|
||||
tx0PreviewsService.setOnRunning(workerStateEvent -> {
|
||||
|
|
|
@ -55,6 +55,9 @@ public class WhirlpoolController {
|
|||
@FXML
|
||||
private CopyableLabel premixFeeRate;
|
||||
|
||||
@FXML
|
||||
private Label lowPremixFeeRate;
|
||||
|
||||
@FXML
|
||||
private ComboBox<Pool> pool;
|
||||
|
||||
|
@ -139,9 +142,12 @@ public class WhirlpoolController {
|
|||
tx0Previews = null;
|
||||
tx0PreviewProperty.set(null);
|
||||
Tx0FeeTarget tx0FeeTarget = FEE_TARGETS.get(newValue.intValue());
|
||||
premixFeeRate.setText(SparrowMinerFeeSupplier.getFee(Integer.parseInt(tx0FeeTarget.getFeeTarget().getValue())) + " sats/vB");
|
||||
premixFeeRate.setText(getFeeRate(tx0FeeTarget) + " sats/vB");
|
||||
lowPremixFeeRate.setVisible(tx0FeeTarget == Tx0FeeTarget.MIN && getFeeRate(tx0FeeTarget) * 2 < getFeeRate(Tx0FeeTarget.BLOCKS_4));
|
||||
});
|
||||
premixPriority.setValue(1);
|
||||
lowPremixFeeRate.managedProperty().bind(lowPremixFeeRate.visibleProperty());
|
||||
lowPremixFeeRate.setVisible(false);
|
||||
|
||||
if(mixConfig.getScode() != null) {
|
||||
step1.setVisible(false);
|
||||
|
@ -218,6 +224,10 @@ public class WhirlpoolController {
|
|||
});
|
||||
}
|
||||
|
||||
private int getFeeRate(Tx0FeeTarget tx0FeeTarget) {
|
||||
return SparrowMinerFeeSupplier.getFee(Integer.parseInt(tx0FeeTarget.getFeeTarget().getValue()));
|
||||
}
|
||||
|
||||
public boolean next() {
|
||||
if(step1.isVisible()) {
|
||||
step1.setVisible(false);
|
||||
|
@ -318,6 +328,7 @@ public class WhirlpoolController {
|
|||
tx0Previews = null;
|
||||
whirlpool.setScode(mixConfig.getScode());
|
||||
whirlpool.setTx0FeeTarget(FEE_TARGETS.get(premixPriority.valueProperty().intValue()));
|
||||
whirlpool.setMixFeeTarget(FEE_TARGETS.get(premixPriority.valueProperty().intValue()));
|
||||
|
||||
Whirlpool.Tx0PreviewsService tx0PreviewsService = new Whirlpool.Tx0PreviewsService(whirlpool, utxoEntries);
|
||||
tx0PreviewsService.setOnRunning(workerStateEvent -> {
|
||||
|
|
|
@ -44,3 +44,7 @@
|
|||
.field-control {
|
||||
-fx-pref-width: 180px;
|
||||
}
|
||||
|
||||
.low-fee-warning {
|
||||
-fx-text-fill: rgb(238, 210, 2);
|
||||
}
|
||||
|
|
|
@ -107,6 +107,17 @@
|
|||
</padding>
|
||||
<Label text="Premix Fee Rate:" styleClass="field-label" />
|
||||
<CopyableLabel fx:id="premixFeeRate" />
|
||||
<Label fx:id="lowPremixFeeRate">
|
||||
<graphic>
|
||||
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="12" icon="EXCLAMATION_TRIANGLE" styleClass="low-fee-warning"/>
|
||||
</graphic>
|
||||
<padding>
|
||||
<Insets left="12" />
|
||||
</padding>
|
||||
<tooltip>
|
||||
<Tooltip text="A low fee rate may delay the first mix."/>
|
||||
</tooltip>
|
||||
</Label>
|
||||
</HBox>
|
||||
</VBox>
|
||||
<VBox fx:id="step4" spacing="15">
|
||||
|
|
Loading…
Reference in a new issue