@Test void shouldIncludeNonEmptyIncompleteBatchesInThePendingBatchCount() { final Batch batch = batchFactory.createBatch(targetChain, UInt64.valueOf(6), UInt64.valueOf(10)); batch.requestMoreBlocks(() -> {}); batchFactory.receiveBlocks( batch, dataStructureUtil.randomSignedBeaconBlock(batch.getLastSlot())); batchChain.add(batch); fillQueue(ZERO); assertThatBatch(batch).isNotAwaitingBlocks(); assertThat(batchChain.stream()).hasSize(MAX_PENDING_BATCHES); }
private void requestMoreBlocks(final Batch batch, final Consumer<Batch> requestCompleteCallback) { batch.requestMoreBlocks(() -> eventThread.execute(() -> requestCompleteCallback.accept(batch))); }
BatchDataRequester { private void requestMoreBlocks(final Batch batch, final Consumer<Batch> requestCompleteCallback) { batch.requestMoreBlocks(() -> eventThread.execute(() -> requestCompleteCallback.accept(batch))); } }
BatchDataRequester { private void requestMoreBlocks(final Batch batch, final Consumer<Batch> requestCompleteCallback) { batch.requestMoreBlocks(() -> eventThread.execute(() -> requestCompleteCallback.accept(batch))); } BatchDataRequester(
      final EventThread eventThread,
      final BatchChain activeBatches,
      final BatchFactory batchFactory,
      final UInt64 batchSize,
      final int maxPendingBatches); }
BatchDataRequester { private void requestMoreBlocks(final Batch batch, final Consumer<Batch> requestCompleteCallback) { batch.requestMoreBlocks(() -> eventThread.execute(() -> requestCompleteCallback.accept(batch))); } BatchDataRequester(
      final EventThread eventThread,
      final BatchChain activeBatches,
      final BatchFactory batchFactory,
      final UInt64 batchSize,
      final int maxPendingBatches); void fillRetrievingQueue(
      final TargetChain targetChain,
      final UInt64 commonAncestorSlot,
      final Consumer<Batch> requestCompleteCallback); }
BatchDataRequester { private void requestMoreBlocks(final Batch batch, final Consumer<Batch> requestCompleteCallback) { batch.requestMoreBlocks(() -> eventThread.execute(() -> requestCompleteCallback.accept(batch))); } BatchDataRequester(
      final EventThread eventThread,
      final BatchChain activeBatches,
      final BatchFactory batchFactory,
      final UInt64 batchSize,
      final int maxPendingBatches); void fillRetrievingQueue(
      final TargetChain targetChain,
      final UInt64 commonAncestorSlot,
      final Consumer<Batch> requestCompleteCallback);  }