@Test void onBlock_shouldUpdateVotesBasedOnAttestationsInBlocks() { final ChainBuilder forkChain = chainBuilder.fork(); final SignedBlockAndState forkBlock = forkChain.generateBlockAtSlot( ONE, BlockOptions.create() .setEth1Data(new Eth1Data(Bytes32.ZERO, UInt64.valueOf(6), Bytes32.ZERO))); final List<SignedBlockAndState> betterChain = chainBuilder.generateBlocksUpToSlot(3); importBlock(forkChain, forkBlock); assertThat(recentChainData.getBestBlockRoot()).contains(forkBlock.getRoot()); betterChain.forEach(blockAndState -> importBlock(chainBuilder, blockAndState)); final BlockOptions options = BlockOptions.create(); chainBuilder .streamValidAttestationsForBlockAtSlot(UInt64.valueOf(4)) .limit(3) .forEach(options::addAttestation); final SignedBlockAndState blockWithAttestations = chainBuilder.generateBlockAtSlot(UInt64.valueOf(4), options); importBlock(chainBuilder, blockWithAttestations); assertThat(recentChainData.getBestBlockRoot()).contains(forkBlock.getRoot()); forkChoice.processHead(blockWithAttestations.getSlot(), false); assertThat(recentChainData.getBestBlockRoot()).contains(blockWithAttestations.getRoot()); }
public void processHead() { processHead(Optional.empty(), false); }
ForkChoice { public void processHead() { processHead(Optional.empty(), false); } }
ForkChoice { public void processHead() { processHead(Optional.empty(), false); } ForkChoice(
      final ForkChoiceExecutor forkChoiceExecutor,
      final RecentChainData recentChainData,
      final StateTransition stateTransition); }
ForkChoice { public void processHead() { processHead(Optional.empty(), false); } ForkChoice(
      final ForkChoiceExecutor forkChoiceExecutor,
      final RecentChainData recentChainData,
      final StateTransition stateTransition); void processHead(); void processHead(UInt64 nodeSlot, boolean syncing); SafeFuture<BlockImportResult> onBlock(
      final SignedBeaconBlock block, Optional<BeaconState> preState); SafeFuture<AttestationProcessingResult> onAttestation(
      final ValidateableAttestation attestation); void save(); void applyIndexedAttestations(final List<ValidateableAttestation> attestations); }
ForkChoice { public void processHead() { processHead(Optional.empty(), false); } ForkChoice(
      final ForkChoiceExecutor forkChoiceExecutor,
      final RecentChainData recentChainData,
      final StateTransition stateTransition); void processHead(); void processHead(UInt64 nodeSlot, boolean syncing); SafeFuture<BlockImportResult> onBlock(
      final SignedBeaconBlock block, Optional<BeaconState> preState); SafeFuture<AttestationProcessingResult> onAttestation(
      final ValidateableAttestation attestation); void save(); void applyIndexedAttestations(final List<ValidateableAttestation> attestations);  }