Search in sources :

Example 1 with ReadOnlyStore

use of tech.pegasys.teku.spec.datastructures.forkchoice.ReadOnlyStore in project teku by ConsenSys.

the class BlockValidator method blockIsFromFutureSlot.

private boolean blockIsFromFutureSlot(SignedBeaconBlock block) {
    ReadOnlyStore store = recentChainData.getStore();
    final long disparityInSeconds = Math.round((float) MAXIMUM_GOSSIP_CLOCK_DISPARITY / 1000.0);
    final UInt64 maxOffset = UInt64.valueOf(disparityInSeconds);
    final UInt64 maxTime = store.getTime().plus(maxOffset);
    UInt64 maxCurrSlot = spec.getCurrentSlot(maxTime, store.getGenesisTime());
    return block.getSlot().compareTo(maxCurrSlot) > 0;
}
Also used : ReadOnlyStore(tech.pegasys.teku.spec.datastructures.forkchoice.ReadOnlyStore) UInt64(tech.pegasys.teku.infrastructure.unsigned.UInt64)

Aggregations

UInt64 (tech.pegasys.teku.infrastructure.unsigned.UInt64)1 ReadOnlyStore (tech.pegasys.teku.spec.datastructures.forkchoice.ReadOnlyStore)1