mirror of
https://github.com/Qortal/qortal.git
synced 2025-05-23 09:56:58 +00:00
Merge branch 'master' into online-accounts-mempow-v2
# Conflicts: # src/main/resources/blockchain.json
This commit is contained in:
commit
1e4281996b
@ -17,10 +17,10 @@
|
|||||||
<ROW Property="Manufacturer" Value="Qortal"/>
|
<ROW Property="Manufacturer" Value="Qortal"/>
|
||||||
<ROW Property="MsiLogging" MultiBuildValue="DefaultBuild:vp"/>
|
<ROW Property="MsiLogging" MultiBuildValue="DefaultBuild:vp"/>
|
||||||
<ROW Property="NTP_GOOD" Value="false"/>
|
<ROW Property="NTP_GOOD" Value="false"/>
|
||||||
<ROW Property="ProductCode" Value="1033:{BB0A4CEC-D437-4D1B-9569-44CD644D073A} 1049:{A3131099-E63A-4926-A449-6A394E2B895A} 2052:{39D2F92F-C2EE-43EA-BEC9-870333921BC0} 2057:{FE9EFD1A-E4DF-4F02-A049-6A0FBFA2AAEF} " Type="16"/>
|
<ROW Property="ProductCode" Value="1033:{E5597539-098E-4BA6-99DF-4D22018BC0D3} 1049:{2B5E55A2-142A-4BED-B3B9-5657162282B7} 2052:{6F19171F-4743-4127-B191-AAFA3FA885D2} 2057:{A1B3108D-EC5D-47A1-AEE4-DBD956E682FB} " Type="16"/>
|
||||||
<ROW Property="ProductLanguage" Value="2057"/>
|
<ROW Property="ProductLanguage" Value="2057"/>
|
||||||
<ROW Property="ProductName" Value="Qortal"/>
|
<ROW Property="ProductName" Value="Qortal"/>
|
||||||
<ROW Property="ProductVersion" Value="3.4.2" Type="32"/>
|
<ROW Property="ProductVersion" Value="3.4.3" Type="32"/>
|
||||||
<ROW Property="RECONFIG_NTP" Value="true"/>
|
<ROW Property="RECONFIG_NTP" Value="true"/>
|
||||||
<ROW Property="REMOVE_BLOCKCHAIN" Value="YES" Type="4"/>
|
<ROW Property="REMOVE_BLOCKCHAIN" Value="YES" Type="4"/>
|
||||||
<ROW Property="REPAIR_BLOCKCHAIN" Value="YES" Type="4"/>
|
<ROW Property="REPAIR_BLOCKCHAIN" Value="YES" Type="4"/>
|
||||||
@ -212,7 +212,7 @@
|
|||||||
<ROW Component="ADDITIONAL_LICENSE_INFO_71" ComponentId="{12A3ADBE-BB7A-496C-8869-410681E6232F}" Directory_="jdk.zipfs_Dir" Attributes="0" KeyPath="ADDITIONAL_LICENSE_INFO_71" Type="0"/>
|
<ROW Component="ADDITIONAL_LICENSE_INFO_71" ComponentId="{12A3ADBE-BB7A-496C-8869-410681E6232F}" Directory_="jdk.zipfs_Dir" Attributes="0" KeyPath="ADDITIONAL_LICENSE_INFO_71" Type="0"/>
|
||||||
<ROW Component="ADDITIONAL_LICENSE_INFO_8" ComponentId="{D53AD95E-CF96-4999-80FC-5812277A7456}" Directory_="java.naming_Dir" Attributes="0" KeyPath="ADDITIONAL_LICENSE_INFO_8" Type="0"/>
|
<ROW Component="ADDITIONAL_LICENSE_INFO_8" ComponentId="{D53AD95E-CF96-4999-80FC-5812277A7456}" Directory_="java.naming_Dir" Attributes="0" KeyPath="ADDITIONAL_LICENSE_INFO_8" Type="0"/>
|
||||||
<ROW Component="ADDITIONAL_LICENSE_INFO_9" ComponentId="{6B7EA9B0-5D17-47A8-B78C-FACE86D15E01}" Directory_="java.net.http_Dir" Attributes="0" KeyPath="ADDITIONAL_LICENSE_INFO_9" Type="0"/>
|
<ROW Component="ADDITIONAL_LICENSE_INFO_9" ComponentId="{6B7EA9B0-5D17-47A8-B78C-FACE86D15E01}" Directory_="java.net.http_Dir" Attributes="0" KeyPath="ADDITIONAL_LICENSE_INFO_9" Type="0"/>
|
||||||
<ROW Component="AI_CustomARPName" ComponentId="{9CE2B8C0-C0A1-481A-8A34-48830F2785EE}" Directory_="APPDIR" Attributes="260" KeyPath="DisplayName" Options="1"/>
|
<ROW Component="AI_CustomARPName" ComponentId="{F17029E8-CCC4-456D-B4AC-1854C81C46B6}" Directory_="APPDIR" Attributes="260" KeyPath="DisplayName" Options="1"/>
|
||||||
<ROW Component="AI_ExePath" ComponentId="{3644948D-AE0B-41BB-9FAF-A79E70490A08}" Directory_="APPDIR" Attributes="260" KeyPath="AI_ExePath"/>
|
<ROW Component="AI_ExePath" ComponentId="{3644948D-AE0B-41BB-9FAF-A79E70490A08}" Directory_="APPDIR" Attributes="260" KeyPath="AI_ExePath"/>
|
||||||
<ROW Component="APPDIR" ComponentId="{680DFDDE-3FB4-47A5-8FF5-934F576C6F91}" Directory_="APPDIR" Attributes="0"/>
|
<ROW Component="APPDIR" ComponentId="{680DFDDE-3FB4-47A5-8FF5-934F576C6F91}" Directory_="APPDIR" Attributes="0"/>
|
||||||
<ROW Component="AccessBridgeCallbacks.h" ComponentId="{288055D1-1062-47A3-AA44-5601B4E38AED}" Directory_="bridge_Dir" Attributes="0" KeyPath="AccessBridgeCallbacks.h" Type="0"/>
|
<ROW Component="AccessBridgeCallbacks.h" ComponentId="{288055D1-1062-47A3-AA44-5601B4E38AED}" Directory_="bridge_Dir" Attributes="0" KeyPath="AccessBridgeCallbacks.h" Type="0"/>
|
||||||
|
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.qortal</groupId>
|
<groupId>org.qortal</groupId>
|
||||||
<artifactId>qortal</artifactId>
|
<artifactId>qortal</artifactId>
|
||||||
<version>3.4.2</version>
|
<version>3.4.3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<properties>
|
<properties>
|
||||||
<skipTests>true</skipTests>
|
<skipTests>true</skipTests>
|
||||||
|
@ -1220,6 +1220,7 @@ public class Block {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (DataException e) {
|
} catch (DataException e) {
|
||||||
|
LOGGER.info("DataException during transaction validation", e);
|
||||||
return ValidationResult.TRANSACTION_INVALID;
|
return ValidationResult.TRANSACTION_INVALID;
|
||||||
} finally {
|
} finally {
|
||||||
// Rollback repository changes made by test-processing transactions above
|
// Rollback repository changes made by test-processing transactions above
|
||||||
|
@ -1375,26 +1375,17 @@ public class Network {
|
|||||||
// We attempted to connect within the last day
|
// We attempted to connect within the last day
|
||||||
// but we last managed to connect over a week ago.
|
// but we last managed to connect over a week ago.
|
||||||
Predicate<PeerData> isNotOldPeer = peerData -> {
|
Predicate<PeerData> isNotOldPeer = peerData -> {
|
||||||
|
if (peerData.getLastAttempted() == null
|
||||||
// First check if there was a connection attempt within the last day
|
|| peerData.getLastAttempted() < now - OLD_PEER_ATTEMPTED_PERIOD) {
|
||||||
if (peerData.getLastAttempted() != null
|
|
||||||
&& peerData.getLastAttempted() > now - OLD_PEER_ATTEMPTED_PERIOD) {
|
|
||||||
|
|
||||||
// There was, so now check if we had a successful connection in the last 7 days
|
|
||||||
if (peerData.getLastConnected() != null
|
|
||||||
&& peerData.getLastConnected() > now - OLD_PEER_CONNECTION_PERIOD) {
|
|
||||||
|
|
||||||
// We did, so this is NOT an 'old' peer
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Last successful connection was more than 1 week ago - this is an 'old' peer
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Best to wait until we have a connection attempt - assume not an 'old' peer until then
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (peerData.getLastConnected() == null
|
||||||
|
|| peerData.getLastConnected() > now - OLD_PEER_CONNECTION_PERIOD) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Disregard peers that are NOT 'old'
|
// Disregard peers that are NOT 'old'
|
||||||
|
@ -27,6 +27,8 @@ import java.nio.channels.SocketChannel;
|
|||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
|
import java.util.concurrent.atomic.LongAccumulator;
|
||||||
|
import java.util.concurrent.atomic.LongAdder;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -153,6 +155,16 @@ public class Peer {
|
|||||||
*/
|
*/
|
||||||
private CommonBlockData commonBlockData;
|
private CommonBlockData commonBlockData;
|
||||||
|
|
||||||
|
// Message stats
|
||||||
|
|
||||||
|
private static class MessageStats {
|
||||||
|
public final LongAdder count = new LongAdder();
|
||||||
|
public final LongAdder totalBytes = new LongAdder();
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Map<MessageType, MessageStats> receivedMessageStats = new ConcurrentHashMap<>();
|
||||||
|
private final Map<MessageType, MessageStats> sentMessageStats = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -542,11 +554,18 @@ public class Peer {
|
|||||||
// Tidy up buffers:
|
// Tidy up buffers:
|
||||||
this.byteBuffer.flip();
|
this.byteBuffer.flip();
|
||||||
// Read-only, flipped buffer's position will be after end of message, so copy that
|
// Read-only, flipped buffer's position will be after end of message, so copy that
|
||||||
|
long messageByteSize = readOnlyBuffer.position();
|
||||||
this.byteBuffer.position(readOnlyBuffer.position());
|
this.byteBuffer.position(readOnlyBuffer.position());
|
||||||
// Copy bytes after read message to front of buffer,
|
// Copy bytes after read message to front of buffer,
|
||||||
// adjusting position accordingly, reset limit to capacity
|
// adjusting position accordingly, reset limit to capacity
|
||||||
this.byteBuffer.compact();
|
this.byteBuffer.compact();
|
||||||
|
|
||||||
|
// Record message stats
|
||||||
|
MessageStats messageStats = this.receivedMessageStats.computeIfAbsent(message.getType(), k -> new MessageStats());
|
||||||
|
// Ideally these two operations would be atomic, we could pack 'count' in top X bits of the 64-bit long, but meh
|
||||||
|
messageStats.count.increment();
|
||||||
|
messageStats.totalBytes.add(messageByteSize);
|
||||||
|
|
||||||
// Unsupported message type? Discard with no further processing
|
// Unsupported message type? Discard with no further processing
|
||||||
if (message.getType() == MessageType.UNSUPPORTED)
|
if (message.getType() == MessageType.UNSUPPORTED)
|
||||||
continue;
|
continue;
|
||||||
@ -609,6 +628,12 @@ public class Peer {
|
|||||||
|
|
||||||
LOGGER.trace("[{}] Sending {} message with ID {} to peer {}",
|
LOGGER.trace("[{}] Sending {} message with ID {} to peer {}",
|
||||||
this.peerConnectionId, this.outputMessageType, this.outputMessageId, this);
|
this.peerConnectionId, this.outputMessageType, this.outputMessageId, this);
|
||||||
|
|
||||||
|
// Record message stats
|
||||||
|
MessageStats messageStats = this.sentMessageStats.computeIfAbsent(message.getType(), k -> new MessageStats());
|
||||||
|
// Ideally these two operations would be atomic, we could pack 'count' in top X bits of the 64-bit long, but meh
|
||||||
|
messageStats.count.increment();
|
||||||
|
messageStats.totalBytes.add(this.outputBuffer.limit());
|
||||||
} catch (MessageException e) {
|
} catch (MessageException e) {
|
||||||
// Something went wrong converting message to bytes, so discard but allow another round
|
// Something went wrong converting message to bytes, so discard but allow another round
|
||||||
LOGGER.warn("[{}] Failed to send {} message with ID {} to peer {}: {}", this.peerConnectionId,
|
LOGGER.warn("[{}] Failed to send {} message with ID {} to peer {}: {}", this.peerConnectionId,
|
||||||
@ -799,8 +824,11 @@ public class Peer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
|
boolean logStats = false;
|
||||||
|
|
||||||
if (!isStopping) {
|
if (!isStopping) {
|
||||||
LOGGER.debug("[{}] Shutting down peer {}", this.peerConnectionId, this);
|
LOGGER.debug("[{}] Shutting down peer {}", this.peerConnectionId, this);
|
||||||
|
logStats = true;
|
||||||
}
|
}
|
||||||
isStopping = true;
|
isStopping = true;
|
||||||
|
|
||||||
@ -812,8 +840,34 @@ public class Peer {
|
|||||||
LOGGER.debug("[{}] IOException while trying to close peer {}", this.peerConnectionId, this);
|
LOGGER.debug("[{}] IOException while trying to close peer {}", this.peerConnectionId, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (logStats && this.receivedMessageStats.size() > 0) {
|
||||||
|
StringBuilder statsBuilder = new StringBuilder(1024);
|
||||||
|
statsBuilder.append("peer ").append(this).append(" message stats:\n=received=");
|
||||||
|
appendMessageStats(statsBuilder, this.receivedMessageStats);
|
||||||
|
statsBuilder.append("\n=sent=");
|
||||||
|
appendMessageStats(statsBuilder, this.sentMessageStats);
|
||||||
|
|
||||||
|
LOGGER.debug(statsBuilder.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void appendMessageStats(StringBuilder statsBuilder, Map<MessageType, MessageStats> messageStats) {
|
||||||
|
if (messageStats.isEmpty()) {
|
||||||
|
statsBuilder.append("\n none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
messageStats.keySet().stream()
|
||||||
|
.sorted(Comparator.comparing(MessageType::name))
|
||||||
|
.forEach(messageType -> {
|
||||||
|
MessageStats stats = messageStats.get(messageType);
|
||||||
|
|
||||||
|
statsBuilder.append("\n ").append(messageType.name())
|
||||||
|
.append(": count=").append(stats.count.sum())
|
||||||
|
.append(", total bytes=").append(stats.totalBytes.sum());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Minimum version
|
// Minimum version
|
||||||
|
|
||||||
|
@ -210,9 +210,9 @@ public class Settings {
|
|||||||
private boolean allowConnectionsWithOlderPeerVersions = true;
|
private boolean allowConnectionsWithOlderPeerVersions = true;
|
||||||
|
|
||||||
/** Minimum time (in seconds) that we should attempt to remain connected to a peer for */
|
/** Minimum time (in seconds) that we should attempt to remain connected to a peer for */
|
||||||
private int minPeerConnectionTime = 5 * 60; // seconds
|
private int minPeerConnectionTime = 60 * 60; // seconds
|
||||||
/** Maximum time (in seconds) that we should attempt to remain connected to a peer for */
|
/** Maximum time (in seconds) that we should attempt to remain connected to a peer for */
|
||||||
private int maxPeerConnectionTime = 60 * 60; // seconds
|
private int maxPeerConnectionTime = 4 * 60 * 60; // seconds
|
||||||
/** Maximum time (in seconds) that a peer should remain connected when requesting QDN data */
|
/** Maximum time (in seconds) that a peer should remain connected when requesting QDN data */
|
||||||
private int maxDataPeerConnectionTime = 2 * 60; // seconds
|
private int maxDataPeerConnectionTime = 2 * 60; // seconds
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"founderEffectiveMintingLevel": 10,
|
"founderEffectiveMintingLevel": 10,
|
||||||
"onlineAccountSignaturesMinLifetime": 43200000,
|
"onlineAccountSignaturesMinLifetime": 43200000,
|
||||||
"onlineAccountSignaturesMaxLifetime": 86400000,
|
"onlineAccountSignaturesMaxLifetime": 86400000,
|
||||||
"onlineAccountsModulusV2Timestamp": 9999999999999,
|
"onlineAccountsModulusV2Timestamp": 1659801600000,
|
||||||
"onlineAccountsMemoryPoWTimestamp": 9999999999999,
|
"onlineAccountsMemoryPoWTimestamp": 9999999999999,
|
||||||
"rewardsByHeight": [
|
"rewardsByHeight": [
|
||||||
{ "height": 1, "reward": 5.00 },
|
{ "height": 1, "reward": 5.00 },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user