From a12ec7f49d01a9906fec14a14da262f137b7762b Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Mon, 24 Aug 2015 13:00:37 +0200 Subject: [PATCH] Fix Tor support does not use all available HTTP seeds. --- core/src/main/java/org/bitcoinj/core/PeerGroup.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/bitcoinj/core/PeerGroup.java b/core/src/main/java/org/bitcoinj/core/PeerGroup.java index 3e96e8bf..9102c8d6 100644 --- a/core/src/main/java/org/bitcoinj/core/PeerGroup.java +++ b/core/src/main/java/org/bitcoinj/core/PeerGroup.java @@ -337,9 +337,12 @@ public class PeerGroup implements TransactionBroadcaster { HttpDiscovery.Details[] httpSeeds = params.getHttpSeeds(); if (httpSeeds.length > 0) { // Use HTTP discovery when Tor is active and there is a Cartographer seed, for a much needed speed boost. - OkHttpClient client = new OkHttpClient(); - client.setSocketFactory(torClient.getSocketFactory()); - result.addPeerDiscovery(new HttpDiscovery(params, httpSeeds[0], client)); + OkHttpClient httpClient = new OkHttpClient(); + httpClient.setSocketFactory(torClient.getSocketFactory()); + List discoveries = Lists.newArrayList(); + for (HttpDiscovery.Details httpSeed : httpSeeds) + discoveries.add(new HttpDiscovery(params, httpSeed, httpClient)); + result.addPeerDiscovery(new MultiplexingDiscovery(params, discoveries)); } else { result.addPeerDiscovery(new TorDiscovery(params, torClient)); }