Skip to content

Commit

Permalink
add block performance to local import
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr committed Nov 5, 2024
1 parent 7e92efd commit 1f6f0c1
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,19 @@ public SafeFuture<BlockImportAndBroadcastValidationResults> importBlock(
final BlockBroadcastValidator blockBroadcastValidator =
blockValidator.initiateBroadcastValidation(block, broadcastValidationLevel);

final Optional<BlockImportPerformance> blockImportPerformance;
if (blockImportMetrics.isPresent()) {
final BlockImportPerformance performance =
new BlockImportPerformance(timeProvider, blockImportMetrics.get());
performance.arrival(recentChainData, block.getSlot(), Optional.of(timeProvider.getTimeInMillis()));
performance.gossipValidation();
blockImportPerformance = Optional.of(performance);
} else {
blockImportPerformance = Optional.empty();
}

final SafeFuture<BlockImportResult> importResult =
doImportBlock(block, Optional.empty(), blockBroadcastValidator, origin);
doImportBlock(block, blockImportPerformance, blockBroadcastValidator, origin);

// we want to intercept any early import exceptions happening before the consensus validation is
// completed
Expand Down

0 comments on commit 1f6f0c1

Please sign in to comment.