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:
CalDescent 2022-07-01 17:29:15 +01:00
parent 610a3fcf83
commit 7c5932a512
2 changed files with 14 additions and 1 deletions

View File

@ -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();

View File

@ -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;
} }