From 6a07b11cff2f60dce21a1f08fa0e072297694658 Mon Sep 17 00:00:00 2001 From: Enrico Del Fante Date: Mon, 6 Dec 2021 09:26:32 +0100 Subject: [PATCH] fixes schema --- .../statetransition/validation/BlockValidator.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/validation/BlockValidator.java b/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/validation/BlockValidator.java index 67e2806e613..db0338628aa 100644 --- a/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/validation/BlockValidator.java +++ b/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/validation/BlockValidator.java @@ -19,6 +19,7 @@ import static tech.pegasys.teku.util.config.Constants.VALID_BLOCK_SET_SIZE; import com.google.common.base.Objects; +import java.util.Optional; import java.util.Set; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -116,14 +117,15 @@ public SafeFuture validate(SignedBeaconBlock block) { block.getProposerIndex()); } if (spec.atSlot(block.getSlot()).miscHelpers().isMergeComplete(postState)) { - ExecutionPayload executionPayload = - block - .getMessage() - .getBody() - .getOptionalExecutionPayload() - .orElseThrow(); + Optional executionPayload = + block.getMessage().getBody().getOptionalExecutionPayload(); + + if (executionPayload.isEmpty()) { + return reject("Missing execution payload"); + } if (executionPayload + .get() .getTimestamp() .compareTo(spec.computeTimeAtSlot(postState, block.getSlot())) != 0) {