use of tech.pegasys.teku.api.response.v1.beacon.GetBlockHeadersResponse in project teku by ConsenSys.
the class ChainDataProviderTest method getBlockHeaders_shouldGetHeadBlockIfNoParameters.
@Test
public void getBlockHeaders_shouldGetHeadBlockIfNoParameters() {
final ChainDataProvider provider = new ChainDataProvider(spec, recentChainData, combinedChainDataClient);
final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock block = storageSystem.getChainHead().getSignedBeaconBlock().orElseThrow();
GetBlockHeadersResponse results = safeJoin(provider.getBlockHeaders(Optional.empty(), Optional.empty()));
assertThat(results.data.get(0).root).isEqualTo(block.getRoot());
}
use of tech.pegasys.teku.api.response.v1.beacon.GetBlockHeadersResponse in project teku by ConsenSys.
the class ChainDataProviderTest method getBlockHeaders_shouldGetBlockGivenSlot.
@Test
public void getBlockHeaders_shouldGetBlockGivenSlot() {
final ChainDataProvider provider = new ChainDataProvider(spec, recentChainData, combinedChainDataClient);
final UInt64 slot = combinedChainDataClient.getCurrentSlot();
GetBlockHeadersResponse results = safeJoin(provider.getBlockHeaders(Optional.empty(), Optional.of(slot)));
assertThat(results.data.get(0).header.message.slot).isEqualTo(slot);
}
use of tech.pegasys.teku.api.response.v1.beacon.GetBlockHeadersResponse in project teku by ConsenSys.
the class ChainDataProviderTest method shouldGetBlockHeadersOnEmptyChainHeadSlot.
@Test
public void shouldGetBlockHeadersOnEmptyChainHeadSlot() {
final ChainDataProvider provider = new ChainDataProvider(spec, recentChainData, combinedChainDataClient);
final UInt64 headSlot = recentChainData.getHeadSlot();
storageSystem.chainUpdater().advanceChain(headSlot.plus(1));
final SafeFuture<GetBlockHeadersResponse> future = provider.getBlockHeaders(Optional.empty(), Optional.empty());
final BlockHeader header = safeJoin(future).data.get(0);
assertThat(header.header.message.slot).isEqualTo(headSlot);
}
Aggregations