|
|
@ -120,6 +120,7 @@ import java.util.Map; |
|
|
|
import java.util.Optional; |
|
|
|
import java.util.Optional; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
|
|
|
import com.google.common.annotations.VisibleForTesting; |
|
|
|
import com.google.common.annotations.VisibleForTesting; |
|
|
|
import com.google.common.base.Preconditions; |
|
|
|
import com.google.common.base.Preconditions; |
|
|
@ -481,7 +482,7 @@ public class RunnerBuilder { |
|
|
|
miningCoordinator.addEthHashObserver(stratumServer.get()); |
|
|
|
miningCoordinator.addEthHashObserver(stratumServer.get()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
staticNodes.stream() |
|
|
|
sanitizePeers(network, staticNodes) |
|
|
|
.map(DefaultPeer::fromEnodeURL) |
|
|
|
.map(DefaultPeer::fromEnodeURL) |
|
|
|
.forEach(peerNetwork::addMaintainConnectionPeer); |
|
|
|
.forEach(peerNetwork::addMaintainConnectionPeer); |
|
|
|
|
|
|
|
|
|
|
@ -657,6 +658,16 @@ public class RunnerBuilder { |
|
|
|
context.getBlockchain()); |
|
|
|
context.getBlockchain()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Stream<EnodeURL> sanitizePeers( |
|
|
|
|
|
|
|
final P2PNetwork network, final Collection<EnodeURL> enodeURLS) { |
|
|
|
|
|
|
|
if (network.getLocalEnode().isEmpty()) { |
|
|
|
|
|
|
|
return enodeURLS.stream(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
final EnodeURL localEnodeURL = network.getLocalEnode().get(); |
|
|
|
|
|
|
|
return enodeURLS.stream() |
|
|
|
|
|
|
|
.filter(enodeURL -> !enodeURL.getNodeId().equals(localEnodeURL.getNodeId())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Optional<NodePermissioningController> buildNodePermissioningController( |
|
|
|
private Optional<NodePermissioningController> buildNodePermissioningController( |
|
|
|
final List<EnodeURL> bootnodesAsEnodeURLs, |
|
|
|
final List<EnodeURL> bootnodesAsEnodeURLs, |
|
|
|
final Synchronizer synchronizer, |
|
|
|
final Synchronizer synchronizer, |
|
|
|