forked from Qortal/qortal
GET /admin/status now returns online account submission status for "isMintingPossible", instead of BlockMinter status.
Online account credit is a more useful definition of "minting" than block signing, from the user's perspective. Should bring UI minting/syncing status in line with the core's systray status.
This commit is contained in:
parent
610a3fcf83
commit
7c5932a512
@ -4,6 +4,7 @@ import javax.xml.bind.annotation.XmlAccessType;
|
|||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
|
||||||
import org.qortal.controller.Controller;
|
import org.qortal.controller.Controller;
|
||||||
|
import org.qortal.controller.OnlineAccountsManager;
|
||||||
import org.qortal.controller.Synchronizer;
|
import org.qortal.controller.Synchronizer;
|
||||||
import org.qortal.network.Network;
|
import org.qortal.network.Network;
|
||||||
|
|
||||||
@ -21,7 +22,7 @@ public class NodeStatus {
|
|||||||
public final int height;
|
public final int height;
|
||||||
|
|
||||||
public NodeStatus() {
|
public NodeStatus() {
|
||||||
this.isMintingPossible = Controller.getInstance().isMintingPossible();
|
this.isMintingPossible = OnlineAccountsManager.getInstance().hasActiveOnlineAccountSignatures();
|
||||||
|
|
||||||
this.syncPercent = Synchronizer.getInstance().getSyncPercent();
|
this.syncPercent = Synchronizer.getInstance().getSyncPercent();
|
||||||
this.isSynchronizing = Synchronizer.getInstance().isSynchronizing();
|
this.isSynchronizing = Synchronizer.getInstance().isSynchronizing();
|
||||||
|
@ -462,6 +462,18 @@ public class OnlineAccountsManager {
|
|||||||
return this.currentOnlineAccounts.containsKey(onlineAccountsTimestamp);
|
return this.currentOnlineAccounts.containsKey(onlineAccountsTimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether we have submitted - or attempted to submit - our online account
|
||||||
|
* signature(s) to the network.
|
||||||
|
* @return true if our signature(s) have been submitted recently.
|
||||||
|
*/
|
||||||
|
public boolean hasActiveOnlineAccountSignatures() {
|
||||||
|
final Long minLatestBlockTimestamp = NTP.getTime() - (2 * 60 * 60 * 1000L);
|
||||||
|
boolean isUpToDate = Controller.getInstance().isUpToDate(minLatestBlockTimestamp);
|
||||||
|
|
||||||
|
return isUpToDate && hasOnlineAccounts();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasOurOnlineAccounts() {
|
public boolean hasOurOnlineAccounts() {
|
||||||
return this.hasOurOnlineAccounts;
|
return this.hasOurOnlineAccounts;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user