|
|
@ -19,7 +19,6 @@ import static java.util.Collections.emptyList; |
|
|
|
import static java.util.concurrent.CompletableFuture.completedFuture; |
|
|
|
import static java.util.concurrent.CompletableFuture.completedFuture; |
|
|
|
import static java.util.stream.Collectors.toMap; |
|
|
|
import static java.util.stream.Collectors.toMap; |
|
|
|
|
|
|
|
|
|
|
|
import org.hyperledger.besu.datatypes.Hash; |
|
|
|
|
|
|
|
import org.hyperledger.besu.ethereum.core.Block; |
|
|
|
import org.hyperledger.besu.ethereum.core.Block; |
|
|
|
import org.hyperledger.besu.ethereum.core.BlockBody; |
|
|
|
import org.hyperledger.besu.ethereum.core.BlockBody; |
|
|
|
import org.hyperledger.besu.ethereum.core.BlockHeader; |
|
|
|
import org.hyperledger.besu.ethereum.core.BlockHeader; |
|
|
@ -75,7 +74,7 @@ public class CompleteBlocksTask extends AbstractRetryingPeerTask<List<Block>> { |
|
|
|
this.headers = headers; |
|
|
|
this.headers = headers; |
|
|
|
this.blocks = |
|
|
|
this.blocks = |
|
|
|
headers.stream() |
|
|
|
headers.stream() |
|
|
|
.filter(this::hasEmptyBody) |
|
|
|
.filter(BlockHeader::hasEmptyBlock) |
|
|
|
.collect( |
|
|
|
.collect( |
|
|
|
toMap( |
|
|
|
toMap( |
|
|
|
BlockHeader::getNumber, |
|
|
|
BlockHeader::getNumber, |
|
|
@ -102,15 +101,6 @@ public class CompleteBlocksTask extends AbstractRetryingPeerTask<List<Block>> { |
|
|
|
return protocolSchedule.getByBlockHeader(header).getWithdrawalsProcessor().isPresent(); |
|
|
|
return protocolSchedule.getByBlockHeader(header).getWithdrawalsProcessor().isPresent(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean hasEmptyBody(final BlockHeader header) { |
|
|
|
|
|
|
|
return header.getOmmersHash().equals(Hash.EMPTY_LIST_HASH) |
|
|
|
|
|
|
|
&& header.getTransactionsRoot().equals(Hash.EMPTY_TRIE_HASH) |
|
|
|
|
|
|
|
&& header |
|
|
|
|
|
|
|
.getWithdrawalsRoot() |
|
|
|
|
|
|
|
.map(wsRoot -> wsRoot.equals(Hash.EMPTY_TRIE_HASH)) |
|
|
|
|
|
|
|
.orElse(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static CompleteBlocksTask forHeaders( |
|
|
|
public static CompleteBlocksTask forHeaders( |
|
|
|
final ProtocolSchedule protocolSchedule, |
|
|
|
final ProtocolSchedule protocolSchedule, |
|
|
|
final EthContext ethContext, |
|
|
|
final EthContext ethContext, |
|
|
|