7311: apply spotless

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
pull/7638/head
Matilda Clerke 1 month ago
parent 1b9922f8b8
commit d827e68d11
  1. 49
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckpointDownloadBlockStep.java

@ -84,31 +84,38 @@ public class CheckpointDownloadBlockStep {
final PeerTaskResult<Block> peerTaskResult) { final PeerTaskResult<Block> peerTaskResult) {
final Block block = peerTaskResult.getResult(); final Block block = peerTaskResult.getResult();
if (synchronizerConfiguration.isPeerTaskSystemEnabled()) { if (synchronizerConfiguration.isPeerTaskSystemEnabled()) {
return ethContext.getScheduler().scheduleServiceTask(() -> { return ethContext
GetReceiptsFromPeerTask task = .getScheduler()
new GetReceiptsFromPeerTask( .scheduleServiceTask(
List.of(block.getHeader()), new BodyValidator(), currentProtocolSpecSupplier); () -> {
PeerTaskExecutorResult<Map<BlockHeader, List<TransactionReceipt>>> executorResult = GetReceiptsFromPeerTask task =
peerTaskExecutor.execute(task); new GetReceiptsFromPeerTask(
List.of(block.getHeader()),
new BodyValidator(),
currentProtocolSpecSupplier);
PeerTaskExecutorResult<Map<BlockHeader, List<TransactionReceipt>>> executorResult =
peerTaskExecutor.execute(task);
if (executorResult.responseCode() == PeerTaskExecutorResponseCode.SUCCESS) { if (executorResult.responseCode() == PeerTaskExecutorResponseCode.SUCCESS) {
List<TransactionReceipt> transactionReceipts = List<TransactionReceipt> transactionReceipts =
executorResult executorResult
.result() .result()
.map((map) -> map.get(block.getHeader())) .map((map) -> map.get(block.getHeader()))
.orElseThrow( .orElseThrow(
() -> () ->
new IllegalStateException("PeerTask response code was success, but empty")); new IllegalStateException(
if (block.getBody().getTransactions().size() != transactionReceipts.size()) { "PeerTask response code was success, but empty"));
throw new IllegalStateException( if (block.getBody().getTransactions().size() != transactionReceipts.size()) {
"PeerTask response code was success, but incorrect number of receipts returned"); 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)); BlockWithReceipts blockWithReceipts =
} else { new BlockWithReceipts(block, transactionReceipts);
return CompletableFuture.completedFuture(Optional.empty()); return CompletableFuture.completedFuture(Optional.of(blockWithReceipts));
} } else {
}); return CompletableFuture.completedFuture(Optional.empty());
}
});
} else { } else {
final org.hyperledger.besu.ethereum.eth.manager.task.GetReceiptsFromPeerTask final org.hyperledger.besu.ethereum.eth.manager.task.GetReceiptsFromPeerTask

Loading…
Cancel
Save