Skip to content

Commit 648f2ee

Browse files
chore: Only use round timestamp for long-term schedules if *all* evts are empty (#23881)
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com> Co-authored-by: Andrew Brandt <andrew.brandt@hashgraph.com>
1 parent 39f29b5 commit 648f2ee

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/HandleWorkflow.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,9 @@ private boolean handleEvents(
368368
final int receiptEntriesBatchSize,
369369
@NonNull final Consumer<ScopedSystemTransaction<StateSignatureTransaction>> stateSignatureTxnCallback) {
370370
boolean transactionsDispatched = false;
371-
for (final var event : round) {
371+
final var iter = round.iterator();
372+
while (iter.hasNext()) {
373+
final var event = iter.next();
372374
if (streamMode != RECORDS) {
373375
writeEventHeader(event);
374376
}
@@ -403,9 +405,8 @@ private boolean handleEvents(
403405
// Clear tx metadata now that we won't use it again
404406
platformTxn.setMetadata(null);
405407
}
406-
if (!transactionsDispatched) {
407-
// If there were no platform transactions to follow with scheduled transactions, then
408-
// use the round consensus time as the execution start time for scheduled transactions
408+
if (!transactionsDispatched && !iter.hasNext()) {
409+
// If the entire round was empty, use the round consensus time as exec time for scheduled transactions
409410
transactionsDispatched = executeScheduledTransactions(state, round.getConsensusTimestamp(), creator);
410411
}
411412
recordCache.maybeCommitReceiptsBatch(

0 commit comments

Comments
 (0)