Search in sources :

Example 1 with GetBlockHeadersResponse

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());
}
Also used : GetBlockHeadersResponse(tech.pegasys.teku.api.response.v1.beacon.GetBlockHeadersResponse) Test(org.junit.jupiter.api.Test)

Example 2 with GetBlockHeadersResponse

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);
}
Also used : GetBlockHeadersResponse(tech.pegasys.teku.api.response.v1.beacon.GetBlockHeadersResponse) UInt64(tech.pegasys.teku.infrastructure.unsigned.UInt64) Test(org.junit.jupiter.api.Test)

Example 3 with GetBlockHeadersResponse

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);
}
Also used : GetBlockHeadersResponse(tech.pegasys.teku.api.response.v1.beacon.GetBlockHeadersResponse) UInt64(tech.pegasys.teku.infrastructure.unsigned.UInt64) SignedBeaconBlockHeader(tech.pegasys.teku.api.schema.SignedBeaconBlockHeader) BlockHeader(tech.pegasys.teku.api.response.v1.beacon.BlockHeader) BeaconBlockHeader(tech.pegasys.teku.api.schema.BeaconBlockHeader) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)3 GetBlockHeadersResponse (tech.pegasys.teku.api.response.v1.beacon.GetBlockHeadersResponse)3 UInt64 (tech.pegasys.teku.infrastructure.unsigned.UInt64)2 BlockHeader (tech.pegasys.teku.api.response.v1.beacon.BlockHeader)1 BeaconBlockHeader (tech.pegasys.teku.api.schema.BeaconBlockHeader)1 SignedBeaconBlockHeader (tech.pegasys.teku.api.schema.SignedBeaconBlockHeader)1