Skip to content

Commit

Permalink
fix blockImportCompleted
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr committed Sep 27, 2024
1 parent 3064bc9 commit bf18171
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public SafeFuture<SendSignedBlockResult> sendSignedBlock(
return gossipAndImportUnblindedSignedBlockAndBlobSidecars(
signedBlock, blobSidecars, broadcastValidationLevel, blockPublishingPerformance);
})
.thenCompose(result -> calculateResult(blockContainer, result));
.thenCompose(result -> calculateResult(blockContainer, result, blockPublishingPerformance));
}

private SafeFuture<BlockImportAndBroadcastValidationResults>
Expand Down Expand Up @@ -133,7 +133,8 @@ abstract void publishBlockAndBlobSidecars(

private SafeFuture<SendSignedBlockResult> calculateResult(
final SignedBlockContainer maybeBlindedBlockContainer,
final BlockImportAndBroadcastValidationResults blockImportAndBroadcastValidationResults) {
final BlockImportAndBroadcastValidationResults blockImportAndBroadcastValidationResults,
final BlockPublishingPerformance blockPublishingPerformance) {

// broadcast validation can fail earlier than block import.
// The assumption is that in that block import will fail but not as fast
Expand All @@ -155,6 +156,7 @@ private SafeFuture<SendSignedBlockResult> calculateResult(
.blockImportResult()
.thenApply(
importResult -> {
blockPublishingPerformance.blockImportCompleted();
if (importResult.isSuccessful()) {
LOG.trace(
"Successfully imported proposed block: {}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ SafeFuture<BlockImportAndBroadcastValidationResults> importBlockAndBlobSidecars(
final BlockPublishingPerformance blockPublishingPerformance) {
// provide blobs for the block before importing it
blockBlobSidecarsTrackersPool.onCompletedBlockAndBlobSidecars(block, blobSidecars);
return blockImportChannel
.importBlock(block, broadcastValidationLevel)
.thenPeek(__ -> blockPublishingPerformance.blockImportCompleted());
return blockImportChannel.importBlock(block, broadcastValidationLevel);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ SafeFuture<BlockImportAndBroadcastValidationResults> importBlockAndBlobSidecars(
final List<BlobSidecar> blobSidecars,
final BroadcastValidationLevel broadcastValidationLevel,
final BlockPublishingPerformance blockPublishingPerformance) {
return blockImportChannel
.importBlock(block, broadcastValidationLevel)
.thenPeek(__ -> blockPublishingPerformance.blockImportCompleted());
return blockImportChannel.importBlock(block, broadcastValidationLevel);
}

@Override
Expand Down

0 comments on commit bf18171

Please sign in to comment.