forked from Qortal/qortal
Report as 100% synced if the latest block is within the last 30 mins
This should hopefully reduce confusion due to APIs reporting 99% synced even though up to date. The systray should never show this since it already treats blocks in the last 30 mins as synced.
This commit is contained in:
parent
fc5672a161
commit
9013d11d24
@ -24,7 +24,7 @@ public class NodeStatus {
|
|||||||
this.isMintingPossible = Controller.getInstance().isMintingPossible();
|
this.isMintingPossible = Controller.getInstance().isMintingPossible();
|
||||||
|
|
||||||
this.syncPercent = Synchronizer.getInstance().getSyncPercent();
|
this.syncPercent = Synchronizer.getInstance().getSyncPercent();
|
||||||
this.isSynchronizing = this.syncPercent != null;
|
this.isSynchronizing = Synchronizer.getInstance().isSynchronizing();
|
||||||
|
|
||||||
this.numberOfConnections = Network.getInstance().getImmutableHandshakedPeers().size();
|
this.numberOfConnections = Network.getInstance().getImmutableHandshakedPeers().size();
|
||||||
|
|
||||||
|
@ -173,6 +173,12 @@ public class Synchronizer extends Thread {
|
|||||||
|
|
||||||
public Integer getSyncPercent() {
|
public Integer getSyncPercent() {
|
||||||
synchronized (this.syncLock) {
|
synchronized (this.syncLock) {
|
||||||
|
// Report as 100% synced if the latest block is within the last 30 mins
|
||||||
|
final Long minLatestBlockTimestamp = NTP.getTime() - (30 * 60 * 1000L);
|
||||||
|
if (Controller.getInstance().isUpToDate(minLatestBlockTimestamp)) {
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
|
||||||
return this.isSynchronizing ? this.syncPercent : null;
|
return this.isSynchronizing ? this.syncPercent : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user