forked from Qortal/qortal
Merge branch 'master' into sync-multiple-blocks
This commit is contained in:
commit
95eaf4c887
@ -275,17 +275,29 @@ public class Controller extends Thread {
|
|||||||
throw new RuntimeException("Can't read build.properties resource", e);
|
throw new RuntimeException("Can't read build.properties resource", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determine build timestamp
|
||||||
String buildTimestampProperty = properties.getProperty("build.timestamp");
|
String buildTimestampProperty = properties.getProperty("build.timestamp");
|
||||||
if (buildTimestampProperty == null)
|
if (buildTimestampProperty == null) {
|
||||||
throw new RuntimeException("Can't read build.timestamp from build.properties resource");
|
throw new RuntimeException("Can't read build.timestamp from build.properties resource");
|
||||||
|
}
|
||||||
this.buildTimestamp = LocalDateTime.parse(buildTimestampProperty, DateTimeFormatter.ofPattern("yyyyMMddHHmmss")).toEpochSecond(ZoneOffset.UTC);
|
if (buildTimestampProperty.startsWith("$")) {
|
||||||
|
// Maven vars haven't been replaced - this was most likely built using an IDE, not via mvn package
|
||||||
|
this.buildTimestamp = System.currentTimeMillis();
|
||||||
|
buildTimestampProperty = "unknown";
|
||||||
|
} else {
|
||||||
|
this.buildTimestamp = LocalDateTime.parse(buildTimestampProperty, DateTimeFormatter.ofPattern("yyyyMMddHHmmss")).toEpochSecond(ZoneOffset.UTC);
|
||||||
|
}
|
||||||
LOGGER.info(String.format("Build timestamp: %s", buildTimestampProperty));
|
LOGGER.info(String.format("Build timestamp: %s", buildTimestampProperty));
|
||||||
|
|
||||||
|
// Determine build version
|
||||||
String buildVersionProperty = properties.getProperty("build.version");
|
String buildVersionProperty = properties.getProperty("build.version");
|
||||||
if (buildVersionProperty == null)
|
if (buildVersionProperty == null) {
|
||||||
throw new RuntimeException("Can't read build.version from build.properties resource");
|
throw new RuntimeException("Can't read build.version from build.properties resource");
|
||||||
|
}
|
||||||
|
if (buildVersionProperty.contains("${git.commit.id.abbrev}")) {
|
||||||
|
// Maven vars haven't been replaced - this was most likely built using an IDE, not via mvn package
|
||||||
|
buildVersionProperty = buildVersionProperty.replace("${git.commit.id.abbrev}", "debug");
|
||||||
|
}
|
||||||
this.buildVersion = VERSION_PREFIX + buildVersionProperty;
|
this.buildVersion = VERSION_PREFIX + buildVersionProperty;
|
||||||
LOGGER.info(String.format("Build version: %s", this.buildVersion));
|
LOGGER.info(String.format("Build version: %s", this.buildVersion));
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import java.io.UnsupportedEncodingException;
|
|||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.qortal.data.network.OnlineAccountData;
|
import org.qortal.data.network.OnlineAccountData;
|
||||||
import org.qortal.transform.Transformer;
|
import org.qortal.transform.Transformer;
|
||||||
@ -25,7 +26,7 @@ public class GetOnlineAccountsMessage extends Message {
|
|||||||
private GetOnlineAccountsMessage(int id, List<OnlineAccountData> onlineAccounts) {
|
private GetOnlineAccountsMessage(int id, List<OnlineAccountData> onlineAccounts) {
|
||||||
super(id, MessageType.GET_ONLINE_ACCOUNTS);
|
super(id, MessageType.GET_ONLINE_ACCOUNTS);
|
||||||
|
|
||||||
this.onlineAccounts = onlineAccounts;
|
this.onlineAccounts = onlineAccounts.stream().limit(MAX_ACCOUNT_COUNT).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OnlineAccountData> getOnlineAccounts() {
|
public List<OnlineAccountData> getOnlineAccounts() {
|
||||||
@ -35,12 +36,9 @@ public class GetOnlineAccountsMessage extends Message {
|
|||||||
public static Message fromByteBuffer(int id, ByteBuffer bytes) throws UnsupportedEncodingException {
|
public static Message fromByteBuffer(int id, ByteBuffer bytes) throws UnsupportedEncodingException {
|
||||||
final int accountCount = bytes.getInt();
|
final int accountCount = bytes.getInt();
|
||||||
|
|
||||||
if (accountCount > MAX_ACCOUNT_COUNT)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
List<OnlineAccountData> onlineAccounts = new ArrayList<>(accountCount);
|
List<OnlineAccountData> onlineAccounts = new ArrayList<>(accountCount);
|
||||||
|
|
||||||
for (int i = 0; i < accountCount; ++i) {
|
for (int i = 0; i < Math.min(MAX_ACCOUNT_COUNT, accountCount); ++i) {
|
||||||
long timestamp = bytes.getLong();
|
long timestamp = bytes.getLong();
|
||||||
|
|
||||||
byte[] publicKey = new byte[Transformer.PUBLIC_KEY_LENGTH];
|
byte[] publicKey = new byte[Transformer.PUBLIC_KEY_LENGTH];
|
||||||
|
@ -6,6 +6,7 @@ import java.io.UnsupportedEncodingException;
|
|||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.qortal.data.network.OnlineAccountData;
|
import org.qortal.data.network.OnlineAccountData;
|
||||||
import org.qortal.transform.Transformer;
|
import org.qortal.transform.Transformer;
|
||||||
@ -25,7 +26,7 @@ public class OnlineAccountsMessage extends Message {
|
|||||||
private OnlineAccountsMessage(int id, List<OnlineAccountData> onlineAccounts) {
|
private OnlineAccountsMessage(int id, List<OnlineAccountData> onlineAccounts) {
|
||||||
super(id, MessageType.ONLINE_ACCOUNTS);
|
super(id, MessageType.ONLINE_ACCOUNTS);
|
||||||
|
|
||||||
this.onlineAccounts = onlineAccounts;
|
this.onlineAccounts = onlineAccounts.stream().limit(MAX_ACCOUNT_COUNT).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OnlineAccountData> getOnlineAccounts() {
|
public List<OnlineAccountData> getOnlineAccounts() {
|
||||||
@ -35,12 +36,9 @@ public class OnlineAccountsMessage extends Message {
|
|||||||
public static Message fromByteBuffer(int id, ByteBuffer bytes) throws UnsupportedEncodingException {
|
public static Message fromByteBuffer(int id, ByteBuffer bytes) throws UnsupportedEncodingException {
|
||||||
final int accountCount = bytes.getInt();
|
final int accountCount = bytes.getInt();
|
||||||
|
|
||||||
if (accountCount > MAX_ACCOUNT_COUNT)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
List<OnlineAccountData> onlineAccounts = new ArrayList<>(accountCount);
|
List<OnlineAccountData> onlineAccounts = new ArrayList<>(accountCount);
|
||||||
|
|
||||||
for (int i = 0; i < accountCount; ++i) {
|
for (int i = 0; i < Math.min(MAX_ACCOUNT_COUNT, accountCount); ++i) {
|
||||||
long timestamp = bytes.getLong();
|
long timestamp = bytes.getLong();
|
||||||
|
|
||||||
byte[] signature = new byte[Transformer.SIGNATURE_LENGTH];
|
byte[] signature = new byte[Transformer.SIGNATURE_LENGTH];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user