mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
more recent blocks tweaks
This commit is contained in:
parent
1605cd2619
commit
d4a1441d65
4 changed files with 9 additions and 8 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
package com.sparrowwallet.sparrow.event;
|
package com.sparrowwallet.sparrow.control;
|
||||||
|
|
||||||
import com.sparrowwallet.drongo.Network;
|
import com.sparrowwallet.drongo.Network;
|
||||||
import com.sparrowwallet.drongo.protocol.Transaction;
|
import com.sparrowwallet.drongo.protocol.Transaction;
|
||||||
|
|
@ -26,7 +26,7 @@ public class BlockCube extends Group {
|
||||||
public static final double CUBE_SIZE = 60;
|
public static final double CUBE_SIZE = 60;
|
||||||
|
|
||||||
private final IntegerProperty weightProperty = new SimpleIntegerProperty(0);
|
private final IntegerProperty weightProperty = new SimpleIntegerProperty(0);
|
||||||
private final DoubleProperty medianFeeProperty = new SimpleDoubleProperty(0);
|
private final DoubleProperty medianFeeProperty = new SimpleDoubleProperty(-1.0d);
|
||||||
private final IntegerProperty heightProperty = new SimpleIntegerProperty(0);
|
private final IntegerProperty heightProperty = new SimpleIntegerProperty(0);
|
||||||
private final IntegerProperty txCountProperty = new SimpleIntegerProperty(0);
|
private final IntegerProperty txCountProperty = new SimpleIntegerProperty(0);
|
||||||
private final LongProperty timestampProperty = new SimpleLongProperty(System.currentTimeMillis());
|
private final LongProperty timestampProperty = new SimpleLongProperty(System.currentTimeMillis());
|
||||||
|
|
@ -56,7 +56,8 @@ public class BlockCube extends Group {
|
||||||
this.medianFeeProperty.addListener((_, _, newValue) -> {
|
this.medianFeeProperty.addListener((_, _, newValue) -> {
|
||||||
medianFeeText.setText("~" + Math.round(Math.max(newValue.doubleValue(), 1.0d)));
|
medianFeeText.setText("~" + Math.round(Math.max(newValue.doubleValue(), 1.0d)));
|
||||||
unitsText.setText(" s/vb");
|
unitsText.setText(" s/vb");
|
||||||
medianFeeTextFlow.setTranslateX((CUBE_SIZE - (medianFeeText.getLayoutBounds().getWidth() + unitsText.getLayoutBounds().getWidth())) / 2);
|
double unitsWidth = TextUtils.computeTextWidth(unitsText.getFont(), unitsText.getText(), 0.0d);
|
||||||
|
medianFeeTextFlow.setTranslateX((CUBE_SIZE - (medianFeeText.getLayoutBounds().getWidth() + unitsWidth)) / 2);
|
||||||
});
|
});
|
||||||
this.txCountProperty.addListener((_, _, newValue) -> {
|
this.txCountProperty.addListener((_, _, newValue) -> {
|
||||||
txCountText.setText(newValue.intValue() == 0 ? "" : newValue + " txes");
|
txCountText.setText(newValue.intValue() == 0 ? "" : newValue + " txes");
|
||||||
|
|
@ -324,7 +325,7 @@ public class BlockCube extends Group {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockCube fromBlockSummary(BlockSummary blockSummary) {
|
public static BlockCube fromBlockSummary(BlockSummary blockSummary) {
|
||||||
return new BlockCube(blockSummary.getWeight().orElse(0), blockSummary.getMedianFee().orElse(0.0d), blockSummary.getHeight(),
|
return new BlockCube(blockSummary.getWeight().orElse(0), blockSummary.getMedianFee().orElse(1.0d), blockSummary.getHeight(),
|
||||||
blockSummary.getTransactionCount().orElse(0), blockSummary.getTimestamp().getTime(), true);
|
blockSummary.getTransactionCount().orElse(0), blockSummary.getTimestamp().getTime(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.sparrowwallet.sparrow.event;
|
package com.sparrowwallet.sparrow.control;
|
||||||
|
|
||||||
import com.sparrowwallet.sparrow.BlockSummary;
|
import com.sparrowwallet.sparrow.BlockSummary;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
|
|
@ -161,12 +161,12 @@ public class BatchedElectrumServerRpc implements ElectrumServerRpc {
|
||||||
try {
|
try {
|
||||||
return batchRequest.execute();
|
return batchRequest.execute();
|
||||||
} catch(JsonRpcBatchException e) {
|
} catch(JsonRpcBatchException e) {
|
||||||
log.warn("Failed to unsubscribe from script hashes: " + e.getErrors().keySet(), e);
|
log.info("Failed to unsubscribe from script hashes: " + e.getErrors().keySet(), e);
|
||||||
Map<String, Boolean> unsubscribedScriptHashes = scriptHashes.stream().collect(Collectors.toMap(s -> s, _ -> true));
|
Map<String, Boolean> unsubscribedScriptHashes = scriptHashes.stream().collect(Collectors.toMap(s -> s, _ -> true));
|
||||||
unsubscribedScriptHashes.keySet().removeIf(scriptHash -> e.getErrors().containsKey(scriptHash));
|
unsubscribedScriptHashes.keySet().removeIf(scriptHash -> e.getErrors().containsKey(scriptHash));
|
||||||
return unsubscribedScriptHashes;
|
return unsubscribedScriptHashes;
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
log.warn("Failed to unsubscribe from script hashes: " + scriptHashes, e);
|
log.info("Failed to unsubscribe from script hashes: " + scriptHashes, e);
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
<?import com.sparrowwallet.sparrow.wallet.OptimizationStrategy?>
|
<?import com.sparrowwallet.sparrow.wallet.OptimizationStrategy?>
|
||||||
<?import com.sparrowwallet.sparrow.control.HelpLabel?>
|
<?import com.sparrowwallet.sparrow.control.HelpLabel?>
|
||||||
<?import com.sparrowwallet.sparrow.control.FeeRangeSlider?>
|
<?import com.sparrowwallet.sparrow.control.FeeRangeSlider?>
|
||||||
<?import com.sparrowwallet.sparrow.event.RecentBlocksView?>
|
<?import com.sparrowwallet.sparrow.control.RecentBlocksView?>
|
||||||
|
|
||||||
<BorderPane stylesheets="@send.css, @wallet.css, @../script.css, @../general.css" styleClass="wallet-pane" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.wallet.SendController">
|
<BorderPane stylesheets="@send.css, @wallet.css, @../script.css, @../general.css" styleClass="wallet-pane" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.wallet.SendController">
|
||||||
<center>
|
<center>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue