Merge branch 'master' into increase-online-timestamp-modulus

This commit is contained in:
CalDescent 2022-07-01 17:46:35 +01:00
commit 65d63487f3
3 changed files with 19 additions and 6 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

@ -125,12 +125,12 @@ public class AdminResource {
} }
private String getNodeType() { private String getNodeType() {
if (Settings.getInstance().isTopOnly()) { if (Settings.getInstance().isLite()) {
return "topOnly";
}
else if (Settings.getInstance().isLite()) {
return "lite"; return "lite";
} }
else if (Settings.getInstance().isTopOnly()) {
return "topOnly";
}
else { else {
return "full"; return "full";
} }

View File

@ -55,7 +55,7 @@ public class OnlineAccountsManager {
private static final long ONLINE_ACCOUNTS_BROADCAST_INTERVAL = 15 * 1000L; // ms private static final long ONLINE_ACCOUNTS_BROADCAST_INTERVAL = 15 * 1000L; // ms
private static final long ONLINE_ACCOUNTS_V2_PEER_VERSION = 0x0300020000L; // v3.2.0 private static final long ONLINE_ACCOUNTS_V2_PEER_VERSION = 0x0300020000L; // v3.2.0
private static final long ONLINE_ACCOUNTS_V3_PEER_VERSION = 0x03000300cbL; // v3.3.203 private static final long ONLINE_ACCOUNTS_V3_PEER_VERSION = 0x0300040000L; // v3.4.0
private final ScheduledExecutorService executor = Executors.newScheduledThreadPool(4, new NamedThreadFactory("OnlineAccounts")); private final ScheduledExecutorService executor = Executors.newScheduledThreadPool(4, new NamedThreadFactory("OnlineAccounts"));
private volatile boolean isStopping = false; private volatile boolean isStopping = false;
@ -471,6 +471,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;
} }