use of tech.pegasys.teku.api.response.v1.beacon.GetBlockRootResponse in project teku by ConsenSys.
the class TekuNode method fetchBeaconHead.
private Optional<Bytes32> fetchBeaconHead() throws IOException {
final String result = httpClient.get(getRestApiUrl(), "/eth/v1/beacon/blocks/head/root");
if (result.isEmpty()) {
return Optional.empty();
}
final GetBlockRootResponse response = jsonProvider.jsonToObject(result, GetBlockRootResponse.class);
return Optional.of(response.data.root);
}
use of tech.pegasys.teku.api.response.v1.beacon.GetBlockRootResponse in project teku by ConsenSys.
the class GetBlockRootIntegrationTest method shouldGetBlockRoot.
@Test
public void shouldGetBlockRoot() throws IOException {
final List<SignedBlockAndState> created = createBlocksAtSlots(10);
final Response response = get("head");
final GetBlockRootResponse body = jsonProvider.jsonToObject(response.body().string(), GetBlockRootResponse.class);
final Root data = body.data;
final Bytes32 blockRoot = created.get(0).getRoot();
assertThat(data).isEqualTo(new Root(blockRoot));
// Bellatrix not enabled
assertThat(body.execution_optimistic).isNull();
}
Aggregations