Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Mar 7, 2023
1 parent 3d7d95b commit 7e1737a
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,16 @@ private SafeFuture<Boolean> requestBlocksByRange() {
requestParams.getCount(),
requestParams.getStartSlot(),
requestParams.getEndSlot());

final RequestManager requestManager =
new RequestManager(lastBlockRoot, getLatestReceivedBlock(), blocksToImport::addLast);

return peer.requestBlocksByRange(
requestParams.getStartSlot(), requestParams.getCount(), requestManager::processBlock)
.thenApply(__ -> shouldRetryBlockByRangeRequest());
.thenApply(__ -> shouldRetryBlocksByRangeRequest());
}

private boolean shouldRetryBlockByRangeRequest() {
private boolean shouldRetryBlocksByRangeRequest() {
return !batchIsComplete() && requestCount.incrementAndGet() < maxRequests;
}

Expand Down

0 comments on commit 7e1737a

Please sign in to comment.