|
|
|
@ -84,10 +84,15 @@ public class CheckpointDownloadBlockStep { |
|
|
|
|
final PeerTaskResult<Block> peerTaskResult) { |
|
|
|
|
final Block block = peerTaskResult.getResult(); |
|
|
|
|
if (synchronizerConfiguration.isPeerTaskSystemEnabled()) { |
|
|
|
|
return ethContext.getScheduler().scheduleServiceTask(() -> { |
|
|
|
|
return ethContext |
|
|
|
|
.getScheduler() |
|
|
|
|
.scheduleServiceTask( |
|
|
|
|
() -> { |
|
|
|
|
GetReceiptsFromPeerTask task = |
|
|
|
|
new GetReceiptsFromPeerTask( |
|
|
|
|
List.of(block.getHeader()), new BodyValidator(), currentProtocolSpecSupplier); |
|
|
|
|
List.of(block.getHeader()), |
|
|
|
|
new BodyValidator(), |
|
|
|
|
currentProtocolSpecSupplier); |
|
|
|
|
PeerTaskExecutorResult<Map<BlockHeader, List<TransactionReceipt>>> executorResult = |
|
|
|
|
peerTaskExecutor.execute(task); |
|
|
|
|
|
|
|
|
@ -98,12 +103,14 @@ public class CheckpointDownloadBlockStep { |
|
|
|
|
.map((map) -> map.get(block.getHeader())) |
|
|
|
|
.orElseThrow( |
|
|
|
|
() -> |
|
|
|
|
new IllegalStateException("PeerTask response code was success, but 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); |
|
|
|
|
BlockWithReceipts blockWithReceipts = |
|
|
|
|
new BlockWithReceipts(block, transactionReceipts); |
|
|
|
|
return CompletableFuture.completedFuture(Optional.of(blockWithReceipts)); |
|
|
|
|
} else { |
|
|
|
|
return CompletableFuture.completedFuture(Optional.empty()); |
|
|
|
|