Skip to content

Commit

Permalink
Add bugfix for empty availablePeerStates
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandraRoatis authored and AionJayT committed Sep 10, 2020
1 parent fbc8918 commit 6b66b7a
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
Expand Down Expand Up @@ -414,6 +415,10 @@ private List<RequestState> updateStatesForRequests(boolean distantFuture, long c
nextMode = SyncMode.NORMAL;

List<RequestState> availableSet = new ArrayList<>(availablePeerStates.values());
if (availableSet.isEmpty()){
return Collections.emptyList();
}

if (!distantFuture) {
// make a single request when !distantFuture
RequestState singleRequest = availableSet.get(random.nextInt(availableSet.size()));
Expand Down

0 comments on commit 6b66b7a

Please sign in to comment.