diff --git a/platform-sdk/platform-apps/tests/ISSTestingTool/src/main/java/com/swirlds/demo/iss/ISSTestingToolState.java b/platform-sdk/platform-apps/tests/ISSTestingTool/src/main/java/com/swirlds/demo/iss/ISSTestingToolState.java index 15a55a26cf00..a5c2da29d1a9 100644 --- a/platform-sdk/platform-apps/tests/ISSTestingTool/src/main/java/com/swirlds/demo/iss/ISSTestingToolState.java +++ b/platform-sdk/platform-apps/tests/ISSTestingTool/src/main/java/com/swirlds/demo/iss/ISSTestingToolState.java @@ -264,10 +264,11 @@ public void handleConsensusRound( final ConsensusEvent event = eventIterator.next(); captureTimestamp(event); event.consensusTransactionIterator().forEachRemaining(transaction -> { - final var transactionWithSystemBytes = handleTransaction(transaction); - if (transactionWithSystemBytes != null) { - stateSignatureTransaction.accept(new ScopedSystemTransaction( - event.getCreatorId(), event.getSoftwareVersion(), transactionWithSystemBytes)); + if (areTransactionBytesSystemOnes(transaction)) { + stateSignatureTransaction.accept( + new ScopedSystemTransaction(event.getCreatorId(), event.getSoftwareVersion(), transaction)); + } else { + handleTransaction(transaction); } }); if (!eventIterator.hasNext()) { @@ -308,27 +309,21 @@ private void captureTimestamp(final ConsensusEvent event) { * Apply a transaction to the state. * * @param transaction the transaction to apply - * @return {@link ConsensusTransaction} only if it represents system transaction wrapped in Bytes */ - private ConsensusTransaction handleTransaction(final ConsensusTransaction transaction) { + private void handleTransaction(final ConsensusTransaction transaction) { if (transaction.isSystem()) { - return null; - } - - if (areTransactionBytesSystemOnes(transaction)) { - return transaction; + return; } final int delta = ByteUtils.byteArrayToInt(transaction.getApplicationTransaction().toByteArray(), 0); runningSum += delta; setChild(RUNNING_SUM_INDEX, new StringLeaf(Long.toString(runningSum))); - - return null; } /** - * Checks if the transaction bytes are system ones. The test creates application transactions with max length of 4. System transactions will be always bigger than that. + * Checks if the transaction bytes are system ones. The test creates application transactions with max length of 4. + * System transactions will be always bigger than that. * * @param transaction the consensus transaction to check * @return true if the transaction bytes are system ones, false otherwise diff --git a/platform-sdk/platform-apps/tests/ISSTestingTool/src/test/java/com/swirlds/demo/iss/ISSTestingToolStateTest.java b/platform-sdk/platform-apps/tests/ISSTestingTool/src/test/java/com/swirlds/demo/iss/ISSTestingToolStateTest.java index 578db1bf2f4d..e1f98ffd2407 100644 --- a/platform-sdk/platform-apps/tests/ISSTestingTool/src/test/java/com/swirlds/demo/iss/ISSTestingToolStateTest.java +++ b/platform-sdk/platform-apps/tests/ISSTestingTool/src/test/java/com/swirlds/demo/iss/ISSTestingToolStateTest.java @@ -158,6 +158,7 @@ void handleConsensusRoundWithDeprecatedSystemTransaction() { // Given givenRoundAndEvent(); + when(consensusTransaction.getApplicationTransaction()).thenReturn(Bytes.EMPTY); when(consensusTransaction.isSystem()).thenReturn(true); // When