From d827e68d11cd976974af517b685a6b0ed6cd297c Mon Sep 17 00:00:00 2001 From: Matilda Clerke Date: Mon, 28 Oct 2024 08:53:04 +1100 Subject: [PATCH] 7311: apply spotless Signed-off-by: Matilda Clerke --- .../CheckpointDownloadBlockStep.java | 49 +++++++++++-------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckpointDownloadBlockStep.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckpointDownloadBlockStep.java index bf32358d83..666ad3e32c 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckpointDownloadBlockStep.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckpointDownloadBlockStep.java @@ -84,31 +84,38 @@ public class CheckpointDownloadBlockStep { final PeerTaskResult peerTaskResult) { final Block block = peerTaskResult.getResult(); if (synchronizerConfiguration.isPeerTaskSystemEnabled()) { - return ethContext.getScheduler().scheduleServiceTask(() -> { - GetReceiptsFromPeerTask task = - new GetReceiptsFromPeerTask( - List.of(block.getHeader()), new BodyValidator(), currentProtocolSpecSupplier); - PeerTaskExecutorResult>> executorResult = - peerTaskExecutor.execute(task); + return ethContext + .getScheduler() + .scheduleServiceTask( + () -> { + GetReceiptsFromPeerTask task = + new GetReceiptsFromPeerTask( + List.of(block.getHeader()), + new BodyValidator(), + currentProtocolSpecSupplier); + PeerTaskExecutorResult>> executorResult = + peerTaskExecutor.execute(task); - if (executorResult.responseCode() == PeerTaskExecutorResponseCode.SUCCESS) { - List transactionReceipts = - executorResult + if (executorResult.responseCode() == PeerTaskExecutorResponseCode.SUCCESS) { + List transactionReceipts = + executorResult .result() .map((map) -> map.get(block.getHeader())) .orElseThrow( - () -> - new IllegalStateException("PeerTask response code was success, but empty")); - if (block.getBody().getTransactions().size() != transactionReceipts.size()) { - throw new IllegalStateException( - "PeerTask response code was success, but incorrect number of receipts returned"); - } - BlockWithReceipts blockWithReceipts = new BlockWithReceipts(block, transactionReceipts); - return CompletableFuture.completedFuture(Optional.of(blockWithReceipts)); - } else { - return CompletableFuture.completedFuture(Optional.empty()); - } - }); + () -> + new IllegalStateException( + "PeerTask response code was success, but empty")); + if (block.getBody().getTransactions().size() != transactionReceipts.size()) { + throw new IllegalStateException( + "PeerTask response code was success, but incorrect number of receipts returned"); + } + BlockWithReceipts blockWithReceipts = + new BlockWithReceipts(block, transactionReceipts); + return CompletableFuture.completedFuture(Optional.of(blockWithReceipts)); + } else { + return CompletableFuture.completedFuture(Optional.empty()); + } + }); } else { final org.hyperledger.besu.ethereum.eth.manager.task.GetReceiptsFromPeerTask