Search in sources :

Example 1 with SignedBeaconBlockHeader

use of tech.pegasys.teku.api.schema.SignedBeaconBlockHeader in project teku by ConsenSys.

the class ChainDataProviderTest method getBlockHeaderByBlockId_shouldGetHeadBlock.

@Test
public void getBlockHeaderByBlockId_shouldGetHeadBlock() throws ExecutionException, InterruptedException {
    final ChainDataProvider provider = new ChainDataProvider(spec, recentChainData, combinedChainDataClient);
    final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock block = storageSystem.getChainHead().getSignedBeaconBlock().orElseThrow();
    ObjectAndMetaData<BlockHeader> result = provider.getBlockHeader("head").get().orElseThrow();
    final BeaconBlockHeader beaconBlockHeader = new BeaconBlockHeader(block.getSlot(), block.getMessage().getProposerIndex(), block.getParentRoot(), block.getStateRoot(), block.getBodyRoot());
    final BlockHeader expected = new BlockHeader(block.getRoot(), true, new SignedBeaconBlockHeader(beaconBlockHeader, new BLSSignature(block.getSignature())));
    assertThat(result).isEqualTo(addMetaData(expected, block.getSlot()));
}
Also used : SignedBeaconBlockHeader(tech.pegasys.teku.api.schema.SignedBeaconBlockHeader) SignedBeaconBlockHeader(tech.pegasys.teku.api.schema.SignedBeaconBlockHeader) BlockHeader(tech.pegasys.teku.api.response.v1.beacon.BlockHeader) BeaconBlockHeader(tech.pegasys.teku.api.schema.BeaconBlockHeader) SignedBeaconBlockHeader(tech.pegasys.teku.api.schema.SignedBeaconBlockHeader) BeaconBlockHeader(tech.pegasys.teku.api.schema.BeaconBlockHeader) BLSSignature(tech.pegasys.teku.api.schema.BLSSignature) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 BlockHeader (tech.pegasys.teku.api.response.v1.beacon.BlockHeader)1 BLSSignature (tech.pegasys.teku.api.schema.BLSSignature)1 BeaconBlockHeader (tech.pegasys.teku.api.schema.BeaconBlockHeader)1 SignedBeaconBlockHeader (tech.pegasys.teku.api.schema.SignedBeaconBlockHeader)1