Update peer validation (#1838)

* Update peer validation

Change the location where peer validation is checked for height
estimates.  Too early and all of peer discovery is stopped.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
pull/1841/head
Danno Ferrin 4 years ago committed by GitHub
parent 27521c5026
commit 5d8449dff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthPeer.java
  2. 3
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthPeers.java

@ -331,9 +331,7 @@ public class EthPeer {
* @return true if the peer is ready to accept requests for data.
*/
public boolean readyForRequests() {
return statusHasBeenSentToPeer.get()
&& statusHasBeenReceivedFromPeer.get()
&& fullyValidated.get();
return statusHasBeenSentToPeer.get() && statusHasBeenReceivedFromPeer.get();
}
/**

@ -153,7 +153,8 @@ public class EthPeers {
}
public Optional<EthPeer> bestPeerWithHeightEstimate() {
return bestPeerMatchingCriteria(p -> p.chainState().hasEstimatedHeight());
return bestPeerMatchingCriteria(
p -> p.isFullyValidated() && p.chainState().hasEstimatedHeight());
}
public Optional<EthPeer> bestPeerMatchingCriteria(final Predicate<EthPeer> matchesCriteria) {

Loading…
Cancel
Save