Search in sources :

Example 1 with ExecutionPayloadStatus

use of tech.pegasys.teku.spec.executionengine.ExecutionPayloadStatus in project teku by ConsenSys.

the class ForkChoiceStrategy method onExecutionPayloadResult.

public void onExecutionPayloadResult(final Bytes32 blockRoot, final PayloadStatus result) {
    if (result.hasFailedExecution()) {
        LOG.warn("Unable to execute Payload for block root {}, Execution Engine is offline", blockRoot, result.getFailureCause().orElseThrow());
        return;
    }
    ExecutionPayloadStatus status = result.getStatus().orElseThrow();
    if (status.isNotValidated()) {
        return;
    }
    protoArrayLock.writeLock().lock();
    try {
        if (status.isValid()) {
            protoArray.markNodeValid(blockRoot);
        } else if (status.isInvalid()) {
            LOG.warn("Payload for block root {} was invalid", blockRoot);
            protoArray.markNodeInvalid(blockRoot, result.getLatestValidHash());
        } else {
            throw new IllegalArgumentException("Unknown payload validity status: " + status);
        }
    } finally {
        protoArrayLock.writeLock().unlock();
    }
}
Also used : ExecutionPayloadStatus(tech.pegasys.teku.spec.executionengine.ExecutionPayloadStatus)

Aggregations

ExecutionPayloadStatus (tech.pegasys.teku.spec.executionengine.ExecutionPayloadStatus)1