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()));
}
Aggregations