@Test public void getEpoch() { final UInt64 epochs = UInt64.valueOf(3); final SignedBlockAndState genesis = chainBuilder.generateGenesis(); while (chainBuilder.getLatestEpoch().isLessThan(epochs)) { chainBuilder.generateNextBlock(); } final BlockTree blockTree = createBlockTree(genesis.getSlot()); for (int i = 0; i < chainBuilder.getLatestSlot().intValue(); i++) { final UInt64 expected = compute_epoch_at_slot(UInt64.valueOf(i)); final SignedBeaconBlock block = chainBuilder.getBlockAtSlot(i); assertThat(blockTree.getEpoch(block.getRoot())) .describedAs("Block at %d should have epoch %s", i, expected) .isEqualTo(expected); } }
public UInt64 getEpoch(Bytes32 blockRoot) { assertBlockIsInTree(blockRoot); final UInt64 slot = blockRootToSlot.get(blockRoot); return compute_epoch_at_slot(slot); }
BlockTree { public UInt64 getEpoch(Bytes32 blockRoot) { assertBlockIsInTree(blockRoot); final UInt64 slot = blockRootToSlot.get(blockRoot); return compute_epoch_at_slot(slot); } }
BlockTree { public UInt64 getEpoch(Bytes32 blockRoot) { assertBlockIsInTree(blockRoot); final UInt64 slot = blockRootToSlot.get(blockRoot); return compute_epoch_at_slot(slot); } private  BlockTree(final HashTree hashTree, final Map<Bytes32, UInt64> blockRootToSlot); }
BlockTree { public UInt64 getEpoch(Bytes32 blockRoot) { assertBlockIsInTree(blockRoot); final UInt64 slot = blockRootToSlot.get(blockRoot); return compute_epoch_at_slot(slot); } private  BlockTree(final HashTree hashTree, final Map<Bytes32, UInt64> blockRootToSlot); static BlockTree create(
      final HashTree hashTree, final Map<Bytes32, UInt64> blockRootToSlot); BlockTree updated(final Bytes32 newRoot, Collection<SignedBeaconBlock> newBlocks); HashTree getHashTree(); Bytes32 getRootHash(); boolean contains(final Bytes32 blockRoot); Set<Bytes32> getAllRoots(); List<Bytes32> getOrderedBlockRoots(); boolean isRootAtNthEpochBoundary(Bytes32 blockRoot, final int n); UInt64 getEpoch(Bytes32 blockRoot); int size(); @Override boolean equals(final Object o); @Override int hashCode(); }
BlockTree { public UInt64 getEpoch(Bytes32 blockRoot) { assertBlockIsInTree(blockRoot); final UInt64 slot = blockRootToSlot.get(blockRoot); return compute_epoch_at_slot(slot); } private  BlockTree(final HashTree hashTree, final Map<Bytes32, UInt64> blockRootToSlot); static BlockTree create(
      final HashTree hashTree, final Map<Bytes32, UInt64> blockRootToSlot); BlockTree updated(final Bytes32 newRoot, Collection<SignedBeaconBlock> newBlocks); HashTree getHashTree(); Bytes32 getRootHash(); boolean contains(final Bytes32 blockRoot); Set<Bytes32> getAllRoots(); List<Bytes32> getOrderedBlockRoots(); boolean isRootAtNthEpochBoundary(Bytes32 blockRoot, final int n); UInt64 getEpoch(Bytes32 blockRoot); int size(); @Override boolean equals(final Object o); @Override int hashCode();  }