diff --git a/platform-sdk/swirlds-common/src/main/java/com/swirlds/common/system/events/BaseEventHashedData.java b/platform-sdk/swirlds-common/src/main/java/com/swirlds/common/system/events/BaseEventHashedData.java index e629b5f02fdd..93689dbd0cd0 100644 --- a/platform-sdk/swirlds-common/src/main/java/com/swirlds/common/system/events/BaseEventHashedData.java +++ b/platform-sdk/swirlds-common/src/main/java/com/swirlds/common/system/events/BaseEventHashedData.java @@ -28,7 +28,6 @@ import com.swirlds.common.io.streams.SerializableDataOutputStream; import com.swirlds.common.system.NodeId; import com.swirlds.common.system.SoftwareVersion; -import com.swirlds.common.system.transaction.ConsensusTransaction; import com.swirlds.common.system.transaction.internal.ConsensusTransactionImpl; import com.swirlds.common.utility.CommonUtils; import edu.umd.cs.findbugs.annotations.NonNull; @@ -89,9 +88,6 @@ private static class ClassVersion { /** the payload: an array of transactions */ private ConsensusTransactionImpl[] transactions; - /** are any of the transactions user transactions */ - private boolean hasUserTransactions; - public BaseEventHashedData() {} /** @@ -131,7 +127,6 @@ public BaseEventHashedData( this.otherParentHash = otherParentHash; this.timeCreated = Objects.requireNonNull(timeCreated, "The timeCreated must not be null"); this.transactions = transactions; - checkUserTransactions(); } /** @@ -236,25 +231,6 @@ public void deserialize( timeCreated = in.readInstant(); in.readInt(); // read serialized length transactions = in.readSerializableArray(ConsensusTransactionImpl[]::new, maxTransactionCount, true); - checkUserTransactions(); - } - - /** - * Check if array of transactions has any user created transaction inside - */ - private void checkUserTransactions() { - if (transactions != null) { - for (final ConsensusTransaction t : getTransactions()) { - if (!t.isSystem()) { - hasUserTransactions = true; - break; - } - } - } - } - - public boolean hasUserTransactions() { - return hasUserTransactions; } @Override diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/internal/EventImpl.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/internal/EventImpl.java index c5bf875bf6f7..d06ff0b0faa1 100644 --- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/internal/EventImpl.java +++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/internal/EventImpl.java @@ -565,10 +565,6 @@ public boolean isCreatedBy(final NodeId id) { return Objects.equals(getCreatorId(), id); } - public boolean hasUserTransactions() { - return baseEvent.getHashedData().hasUserTransactions(); - } - ////////////////////////////////////////// // BaseEventUnhashedData ////////////////////////////////////////// diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/metrics/ConsensusMetricsImpl.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/metrics/ConsensusMetricsImpl.java index 4cd679bd497a..3b102e2b53e9 100644 --- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/metrics/ConsensusMetricsImpl.java +++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/metrics/ConsensusMetricsImpl.java @@ -113,9 +113,9 @@ public class ConsensusMetricsImpl implements ConsensusMetrics { private final NodeId selfId; /** - * Time when this platform received the first event created by someone else in the most recent round. - * This is used to calculate Statistics.avgFirstEventInRoundReceivedTime which is "time for event, from - * receiving the first event in a round to the first event in the next round". + * Time when this platform received the first event created by someone else in the most recent round. This is used + * to calculate Statistics.avgFirstEventInRoundReceivedTime which is "time for event, from receiving the first event + * in a round to the first event in the next round". */ private static volatile Instant firstEventInLastRoundTime = null; /** @@ -126,12 +126,9 @@ public class ConsensusMetricsImpl implements ConsensusMetrics { /** * Constructor of {@code ConsensusMetricsImpl} * - * @param selfId - * the {@link NodeId} of this node - * @param metrics - * a reference to the metrics-system - * @throws IllegalArgumentException - * if one of the parameters is {@code null} + * @param selfId the {@link NodeId} of this node + * @param metrics a reference to the metrics-system + * @throws IllegalArgumentException if one of the parameters is {@code null} */ public ConsensusMetricsImpl(final NodeId selfId, final Metrics metrics) { this.selfId = CommonUtils.throwArgNull(selfId, "selfId"); @@ -213,34 +210,24 @@ public void consensusReached(final EventImpl event) { // Keep a running average of how many seconds from when I first know of an event // until it achieves consensus. Actually, keep two such averages: one for events I // create, and one for events I receive. - // Because of transThrottle, these statistics can end up being misleading, so we are only tracking events that - // have user transactions in them. - if (event.hasUserTransactions()) { - if (Objects.equals(selfId, event.getCreatorId())) { // set either created or received time to now - avgCreatedConsensusTime.update( - event.getBaseEvent().getTimeReceived().until(Instant.now(), ChronoUnit.NANOS) - * NANOSECONDS_TO_SECONDS); - } else { - avgReceivedConsensusTime.update( - event.getBaseEvent().getTimeReceived().until(Instant.now(), ChronoUnit.NANOS) - * NANOSECONDS_TO_SECONDS); - avgCreatedReceivedConsensusTime.update( - event.getTimeCreated().until(Instant.now(), ChronoUnit.NANOS) * NANOSECONDS_TO_SECONDS); - } + if (Objects.equals(selfId, event.getCreatorId())) { + avgCreatedConsensusTime.update( + event.getBaseEvent().getTimeReceived().until(Instant.now(), ChronoUnit.NANOS) + * NANOSECONDS_TO_SECONDS); + } else { + avgReceivedConsensusTime.update( + event.getBaseEvent().getTimeReceived().until(Instant.now(), ChronoUnit.NANOS) + * NANOSECONDS_TO_SECONDS); + avgCreatedReceivedConsensusTime.update( + event.getTimeCreated().until(Instant.now(), ChronoUnit.NANOS) * NANOSECONDS_TO_SECONDS); } - - // Because of transThrottle, these statistics can end up being misleading, so we are only tracking events that - // have user transactions in them. - if (event.hasUserTransactions()) { - if (Objects.equals(selfId, event.getCreatorId())) { - avgSelfCreatedTimestamp.update( - event.getTimeCreated().until(event.getConsensusTimestamp(), ChronoUnit.NANOS) - * NANOSECONDS_TO_SECONDS); - } else { - avgOtherReceivedTimestamp.update( - event.getBaseEvent().getTimeReceived().until(event.getConsensusTimestamp(), ChronoUnit.NANOS) - * NANOSECONDS_TO_SECONDS); - } + if (Objects.equals(selfId, event.getCreatorId())) { + avgSelfCreatedTimestamp.update(event.getTimeCreated().until(event.getConsensusTimestamp(), ChronoUnit.NANOS) + * NANOSECONDS_TO_SECONDS); + } else { + avgOtherReceivedTimestamp.update( + event.getBaseEvent().getTimeReceived().until(event.getConsensusTimestamp(), ChronoUnit.NANOS) + * NANOSECONDS_TO_SECONDS); } }