@Test void shouldMarkAllBatchesInChainAsInvalidWhenBlockFailsToImport() { assertThat(sync.syncToChain(targetChain)).isNotDone(); final Batch batch0 = batches.get(0); final Batch batch1 = batches.get(1); final Batch batch2 = batches.get(2); final Batch batch3 = batches.get(3); batches.receiveBlocks(batch0, chainBuilder.generateBlockAtSlot(1).getBlock()); batches.receiveBlocks(batch1, chainBuilder.generateBlockAtSlot(BATCH_SIZE.plus(1)).getBlock()); batches.receiveBlocks( batch2, chainBuilder.generateBlockAtSlot(BATCH_SIZE.times(2).plus(1)).getBlock()); batches.receiveBlocks( batch3, dataStructureUtil.randomSignedBeaconBlock(BATCH_SIZE.times(3).plus(1))); batches.getImportResult(batch0).complete(IMPORT_FAILED); batches.assertMarkedInvalid(batch0); batches.assertMarkedInvalid(batch1); batches.assertMarkedInvalid(batch2); batches.assertNotMarkedInvalid(batch3); assertThatBatch(batch3).isNotContested(); assertBatchActive(batch0); }
@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);  }