Skip to content

Commit

Permalink
Move prewarm wait to end of all block activity (#7348)
Browse files Browse the repository at this point in the history
  • Loading branch information
benaadams authored Aug 20, 2024
1 parent 7f130db commit 342d40e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ the previous head state.*/
? null
: _preWarmer?.PreWarmCaches(suggestedBlock, preBlockStateRoot!, cancellationTokenSource.Token);
(Block processedBlock, TxReceipt[] receipts) = ProcessOne(suggestedBlock, options, blockTracer);
// Block is processed, we can cancel the prewarm task
cancellationTokenSource.Cancel();
preWarmTask?.GetAwaiter().GetResult();
processedBlocks[i] = processedBlock;

// be cautious here as AuRa depends on processing
Expand All @@ -147,6 +147,8 @@ the previous head state.*/
}

preBlockStateRoot = processedBlock.StateRoot;
// Make sure the prewarm task is finished before we reset the state
preWarmTask?.GetAwaiter().GetResult();
_stateProvider.Reset(resizeCollections: true);
}

Expand Down

0 comments on commit 342d40e

Please sign in to comment.