Merge branch 'refs/heads/7311-add-peertask-foundation-code' into 7311-add-GetReceiptsFromPeerTask

pull/7638/head
Matilda Clerke 2 months ago
commit b910b4d611
  1. 2
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java
  2. 12
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/peertask/DefaultPeerSelectorTest.java

@ -137,7 +137,7 @@ public class PeerTaskExecutor {
private boolean sleepBetweenRetries() {
try {
//sleep for 1 second to match implemented wait between retries in AbstractRetryingPeerTask
// sleep for 1 second to match implemented wait between retries in AbstractRetryingPeerTask
Thread.sleep(1000);
return true;
} catch (InterruptedException e) {

@ -60,19 +60,21 @@ public class DefaultPeerSelectorTest {
@Test
public void testGetPeerButNoPeerMatchesFilter() {
EthPeer protocol1With5ReputationPeer =
createTestPeer(Set.of(Capability.create("capability1", 1)), "protocol1", 5);
createTestPeer(Set.of(Capability.create("capability1", 1)), "protocol1", 5);
peerSelector.addPeer(protocol1With5ReputationPeer);
EthPeer protocol1With4ReputationPeer =
createTestPeer(Set.of(Capability.create("capability1", 1)), "protocol1", 4);
createTestPeer(Set.of(Capability.create("capability1", 1)), "protocol1", 4);
peerSelector.addPeer(protocol1With4ReputationPeer);
EthPeer protocol2With50ReputationPeer =
createTestPeer(Set.of(Capability.create("capability1", 1)), "protocol2", 50);
createTestPeer(Set.of(Capability.create("capability1", 1)), "protocol2", 50);
peerSelector.addPeer(protocol2With50ReputationPeer);
EthPeer protocol2With4ReputationPeer =
createTestPeer(Set.of(Capability.create("capability1", 1)), "protocol2", 4);
createTestPeer(Set.of(Capability.create("capability1", 1)), "protocol2", 4);
peerSelector.addPeer(protocol2With4ReputationPeer);
Assertions.assertThrows(NoAvailablePeerException.class, () -> peerSelector.getPeer((p) -> p.getProtocolName().equals("fake protocol")));
Assertions.assertThrows(
NoAvailablePeerException.class,
() -> peerSelector.getPeer((p) -> p.getProtocolName().equals("fake protocol")));
}
private EthPeer createTestPeer(

Loading…
Cancel
Save