diff --git a/src/main/java/org/qora/settings/Settings.java b/src/main/java/org/qora/settings/Settings.java index e2868243..3f56c47a 100644 --- a/src/main/java/org/qora/settings/Settings.java +++ b/src/main/java/org/qora/settings/Settings.java @@ -68,11 +68,12 @@ public class Settings { private int maxUnconfirmedPerAccount = 100; /** Max milliseconds into future for accepting new, unconfirmed transactions */ private int maxTransactionTimestampFuture = 24 * 60 * 60 * 1000; // milliseconds - // auto-update + /** Whether we check, fetch and install auto-updates */ private boolean autoUpdateEnabled = true; // Peer-to-peer related private boolean isTestNet = false; + /** Port number for inbound peer-to-peer connections. */ private Integer listenPort; /** Minimum number of peers to allow block generation / synchronization. */ private int minBlockchainPeers = 3; @@ -97,7 +98,7 @@ public class Settings { "https://raw.githubusercontent.com@151.101.16.133/catbref/qora-core/%s/qora-core.jar" }; - // NTP sources + /** Array of NTP server hostnames. */ private String[] ntpServers = new String[] { "pool.ntp.org", "0.pool.ntp.org", @@ -110,6 +111,8 @@ public class Settings { "2.cn.pool.ntp.org", "3.cn.pool.ntp.org" }; + /** Additional offset added to values returned by NTP.getTime() */ + private long testNtpOffset = 0; // Constructors @@ -328,4 +331,8 @@ public class Settings { return this.ntpServers; } + public long getTestNtpOffset() { + return this.testNtpOffset; + } + } diff --git a/src/main/java/org/qora/utils/NTP.java b/src/main/java/org/qora/utils/NTP.java index 59a75b74..53851e79 100644 --- a/src/main/java/org/qora/utils/NTP.java +++ b/src/main/java/org/qora/utils/NTP.java @@ -151,7 +151,7 @@ public class NTP implements Runnable { if (NTP.offset == null) return null; - return System.currentTimeMillis() + NTP.offset; + return System.currentTimeMillis() + NTP.offset + Settings.getInstance().getTestNtpOffset(); } public void run() {