forked from Qortal/qortal
Include "blocks remaining" in systray when syncing from more than 60 minutes away from a peer's chain tip.
This commit is contained in:
parent
b64c053531
commit
59a804c560
@ -838,6 +838,12 @@ public class Controller extends Thread {
|
||||
String tooltip = String.format("%s - %d %s", actionText, numberOfPeers, connectionsText);
|
||||
if (!Settings.getInstance().isLite()) {
|
||||
tooltip = tooltip.concat(String.format(" - %s %d", heightText, height));
|
||||
|
||||
final Integer blocksRemaining = Synchronizer.getInstance().getBlocksRemaining();
|
||||
if (blocksRemaining != null && blocksRemaining > 0) {
|
||||
String blocksRemainingText = Translator.INSTANCE.translate("SysTray", "BLOCKS_REMAINING");
|
||||
tooltip = tooltip.concat(String.format(" - %d %s", blocksRemaining, blocksRemainingText));
|
||||
}
|
||||
}
|
||||
tooltip = tooltip.concat(String.format("\n%s: %s", Translator.INSTANCE.translate("SysTray", "BUILD_VERSION"), this.buildVersion));
|
||||
SysTray.getInstance().setToolTipText(tooltip);
|
||||
|
@ -76,6 +76,8 @@ public class Synchronizer extends Thread {
|
||||
private volatile boolean isSynchronizing = false;
|
||||
/** Temporary estimate of synchronization progress for SysTray use. */
|
||||
private volatile int syncPercent = 0;
|
||||
/** Temporary estimate of blocks remaining for SysTray use. */
|
||||
private volatile int blocksRemaining = 0;
|
||||
|
||||
private static volatile boolean requestSync = false;
|
||||
private boolean syncRequestPending = false;
|
||||
@ -181,6 +183,18 @@ public class Synchronizer extends Thread {
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getBlocksRemaining() {
|
||||
synchronized (this.syncLock) {
|
||||
// Report as 0 blocks remaining if the latest block is within the last 60 mins
|
||||
final Long minLatestBlockTimestamp = NTP.getTime() - (60 * 60 * 1000L);
|
||||
if (Controller.getInstance().isUpToDate(minLatestBlockTimestamp)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.isSynchronizing ? this.blocksRemaining : null;
|
||||
}
|
||||
}
|
||||
|
||||
public void requestSync() {
|
||||
requestSync = true;
|
||||
}
|
||||
@ -1457,6 +1471,12 @@ public class Synchronizer extends Thread {
|
||||
|
||||
repository.saveChanges();
|
||||
|
||||
synchronized (this.syncLock) {
|
||||
if (peer.getChainTipData() != null) {
|
||||
this.blocksRemaining = peer.getChainTipData().getHeight() - newBlock.getBlockData().getHeight();
|
||||
}
|
||||
}
|
||||
|
||||
Controller.getInstance().onNewBlock(newBlock.getBlockData());
|
||||
}
|
||||
|
||||
@ -1552,6 +1572,12 @@ public class Synchronizer extends Thread {
|
||||
|
||||
repository.saveChanges();
|
||||
|
||||
synchronized (this.syncLock) {
|
||||
if (peer.getChainTipData() != null) {
|
||||
this.blocksRemaining = peer.getChainTipData().getHeight() - newBlock.getBlockData().getHeight();
|
||||
}
|
||||
}
|
||||
|
||||
Controller.getInstance().onNewBlock(newBlock.getBlockData());
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,8 @@ AUTO_UPDATE = Automatisches Update
|
||||
|
||||
BLOCK_HEIGHT = height
|
||||
|
||||
BLOCKS_REMAINING = blocks remaining
|
||||
|
||||
BUILD_VERSION = Build-Version
|
||||
|
||||
CHECK_TIME_ACCURACY = Prüfe Zeitgenauigkeit
|
||||
|
@ -7,6 +7,8 @@ AUTO_UPDATE = Auto Update
|
||||
|
||||
BLOCK_HEIGHT = height
|
||||
|
||||
BLOCKS_REMAINING = blocks remaining
|
||||
|
||||
BUILD_VERSION = Build version
|
||||
|
||||
CHECK_TIME_ACCURACY = Check time accuracy
|
||||
|
@ -7,6 +7,8 @@ AUTO_UPDATE = Actualización automática
|
||||
|
||||
BLOCK_HEIGHT = altura
|
||||
|
||||
BLOCKS_REMAINING = blocks remaining
|
||||
|
||||
BUILD_VERSION = Versión de compilación
|
||||
|
||||
CHECK_TIME_ACCURACY = Comprobar la precisión del tiempo
|
||||
|
@ -7,6 +7,8 @@ AUTO_UPDATE = Automaattinen päivitys
|
||||
|
||||
BLOCK_HEIGHT = korkeus
|
||||
|
||||
BLOCKS_REMAINING = blocks remaining
|
||||
|
||||
BUILD_VERSION = Versio
|
||||
|
||||
CHECK_TIME_ACCURACY = Tarkista ajan tarkkuus
|
||||
|
@ -7,6 +7,8 @@ AUTO_UPDATE = Mise à jour automatique
|
||||
|
||||
BLOCK_HEIGHT = hauteur
|
||||
|
||||
BLOCKS_REMAINING = blocks remaining
|
||||
|
||||
BUILD_VERSION = Numéro de version
|
||||
|
||||
CHECK_TIME_ACCURACY = Vérifier l'heure
|
||||
|
@ -7,6 +7,8 @@ AUTO_UPDATE = Automatikus Frissítés
|
||||
|
||||
BLOCK_HEIGHT = blokkmagasság
|
||||
|
||||
BLOCKS_REMAINING = blocks remaining
|
||||
|
||||
BUILD_VERSION = Verzió
|
||||
|
||||
CHECK_TIME_ACCURACY = Óra pontosságának ellenőrzése
|
||||
|
@ -7,6 +7,8 @@ AUTO_UPDATE = Aggiornamento automatico
|
||||
|
||||
BLOCK_HEIGHT = altezza
|
||||
|
||||
BLOCKS_REMAINING = blocks remaining
|
||||
|
||||
BUILD_VERSION = Versione
|
||||
|
||||
CHECK_TIME_ACCURACY = Controlla la precisione dell'ora
|
||||
|
@ -7,6 +7,8 @@ AUTO_UPDATE = 자동 업데이트
|
||||
|
||||
BLOCK_HEIGHT = 높이
|
||||
|
||||
BLOCKS_REMAINING = blocks remaining
|
||||
|
||||
BUILD_VERSION = 빌드 버전
|
||||
|
||||
CHECK_TIME_ACCURACY = 시간 정확도 점검
|
||||
|
@ -7,6 +7,8 @@ AUTO_UPDATE = Automatische Update
|
||||
|
||||
BLOCK_HEIGHT = Block hoogte
|
||||
|
||||
BLOCKS_REMAINING = blocks remaining
|
||||
|
||||
BUILD_VERSION = Versie nummer
|
||||
|
||||
CHECK_TIME_ACCURACY = Controleer accuraatheid van de tijd
|
||||
|
@ -7,6 +7,8 @@ AUTO_UPDATE = Actualizare automata
|
||||
|
||||
BLOCK_HEIGHT = dimensiune
|
||||
|
||||
BLOCKS_REMAINING = blocks remaining
|
||||
|
||||
BUILD_VERSION = versiunea compilatiei
|
||||
|
||||
CHECK_TIME_ACCURACY = verificare exactitate ora
|
||||
|
@ -7,6 +7,8 @@ AUTO_UPDATE = Автоматическое обновление
|
||||
|
||||
BLOCK_HEIGHT = Высота блока
|
||||
|
||||
BLOCKS_REMAINING = blocks remaining
|
||||
|
||||
BUILD_VERSION = Версия сборки
|
||||
|
||||
CHECK_TIME_ACCURACY = Проверка точного времени
|
||||
|
@ -7,6 +7,8 @@ AUTO_UPDATE = Automatisk uppdatering
|
||||
|
||||
BLOCK_HEIGHT = höjd
|
||||
|
||||
BLOCKS_REMAINING = blocks remaining
|
||||
|
||||
BUILD_VERSION = Byggversion
|
||||
|
||||
CHECK_TIME_ACCURACY = Kontrollera tidens noggrannhet
|
||||
|
@ -7,6 +7,8 @@ AUTO_UPDATE = 自动更新
|
||||
|
||||
BLOCK_HEIGHT = 区块高度
|
||||
|
||||
BLOCKS_REMAINING = blocks remaining
|
||||
|
||||
BUILD_VERSION = 版本
|
||||
|
||||
CHECK_TIME_ACCURACY = 检查时间准确性
|
||||
|
@ -7,6 +7,8 @@ AUTO_UPDATE = 自動更新
|
||||
|
||||
BLOCK_HEIGHT = 區塊高度
|
||||
|
||||
BLOCKS_REMAINING = blocks remaining
|
||||
|
||||
BUILD_VERSION = 版本
|
||||
|
||||
CHECK_TIME_ACCURACY = 檢查時間準確性
|
||||
|
Loading…
Reference in New Issue
Block a user