@Test void shouldNotMarkBatchesAsContestedWhenBlocksDoNotLineUpBecauseOfIncompleteBatchesBetween() { assertThat(sync.syncToChain(targetChain)).isNotDone(); final Batch batch0 = batches.get(0); final Batch batch1 = batches.get(1); final Batch batch2 = batches.get(2); final SignedBeaconBlock batch0Block = chainBuilder.generateBlockAtSlot(batch0.getLastSlot()).getBlock(); final SignedBeaconBlock batch1Block = chainBuilder.generateBlockAtSlot(batch1.getLastSlot()).getBlock(); final SignedBeaconBlock batch2Block = chainBuilder.generateBlockAtSlot(batch2.getLastSlot()).getBlock(); batches.receiveBlocks(batch0, batch0Block); batches.receiveBlocks(batch2, batch2Block); assertNoBatchesImported(); assertThatBatch(batch0).isNotContested(); assertThatBatch(batch1).isNotContested(); assertThatBatch(batch2).isNotContested(); batches.receiveBlocks(batch1, batch1Block); assertThatBatch(batch0).isConfirmed(); assertThatBatch(batch1).isConfirmed(); assertThatBatch(batch2).hasConfirmedFirstBlock(); }
@Override public SafeFuture<SyncResult> syncToChain(final TargetChain targetChain) { final SafeFuture<SyncResult> result = new SafeFuture<>(); eventThread.execute(() -> switchSyncTarget(targetChain, result)); return result; }
BatchSync implements Sync { @Override public SafeFuture<SyncResult> syncToChain(final TargetChain targetChain) { final SafeFuture<SyncResult> result = new SafeFuture<>(); eventThread.execute(() -> switchSyncTarget(targetChain, result)); return result; } }
BatchSync implements Sync { @Override public SafeFuture<SyncResult> syncToChain(final TargetChain targetChain) { final SafeFuture<SyncResult> result = new SafeFuture<>(); eventThread.execute(() -> switchSyncTarget(targetChain, result)); return result; } private  BatchSync(
      final EventThread eventThread,
      final RecentChainData recentChainData,
      final BatchChain activeBatches,
      final BatchImporter batchImporter,
      final BatchDataRequester batchDataRequester); }
BatchSync implements Sync { @Override public SafeFuture<SyncResult> syncToChain(final TargetChain targetChain) { final SafeFuture<SyncResult> result = new SafeFuture<>(); eventThread.execute(() -> switchSyncTarget(targetChain, result)); return result; } private  BatchSync(
      final EventThread eventThread,
      final RecentChainData recentChainData,
      final BatchChain activeBatches,
      final BatchImporter batchImporter,
      final BatchDataRequester batchDataRequester); static BatchSync create(
      final EventThread eventThread,
      final RecentChainData recentChainData,
      final BatchImporter batchImporter,
      final BatchFactory batchFactory,
      final UInt64 batchSize); @Override SafeFuture<SyncResult> syncToChain(final TargetChain targetChain); }
BatchSync implements Sync { @Override public SafeFuture<SyncResult> syncToChain(final TargetChain targetChain) { final SafeFuture<SyncResult> result = new SafeFuture<>(); eventThread.execute(() -> switchSyncTarget(targetChain, result)); return result; } private  BatchSync(
      final EventThread eventThread,
      final RecentChainData recentChainData,
      final BatchChain activeBatches,
      final BatchImporter batchImporter,
      final BatchDataRequester batchDataRequester); static BatchSync create(
      final EventThread eventThread,
      final RecentChainData recentChainData,
      final BatchImporter batchImporter,
      final BatchFactory batchFactory,
      final UInt64 batchSize); @Override SafeFuture<SyncResult> syncToChain(final TargetChain targetChain);  }