Skip to content

Commit

Permalink
PeerGroup: Add ignoreHttpSeeds
Browse files Browse the repository at this point in the history
  • Loading branch information
ManfredKarrer authored and oscarguindzberg committed Dec 20, 2018
1 parent b0290ad commit 9d04071
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/src/main/java/org/bitcoinj/core/PeerGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ public class PeerGroup implements TransactionBroadcaster {
private final CopyOnWriteArrayList<Wallet> wallets;
private final CopyOnWriteArrayList<PeerFilterProvider> peerFilterProviders;

// Give the client the option to disable HttpSeeds
private static boolean ignoreHttpSeeds;

public static void setIgnoreHttpSeeds(boolean ignoreHttpSeeds) {
PeerGroup.ignoreHttpSeeds = ignoreHttpSeeds;
}

// This event listener is added to every peer. It's here so when we announce transactions via an "inv", every
// peer can fetch them.
private final PeerListener peerListener = new PeerListener();
Expand Down Expand Up @@ -379,7 +386,7 @@ public static PeerGroup newWithTor(Context context, @Nullable AbstractBlockChain
if (doDiscovery) {
NetworkParameters params = context.getParams();
HttpDiscovery.Details[] httpSeeds = params.getHttpSeeds();
if (httpSeeds.length > 0) {
if (!ignoreHttpSeeds && httpSeeds.length > 0) {
// Use HTTP discovery when Tor is active and there is a Cartographer seed, for a much needed speed boost.
OkHttpClient httpClient = new OkHttpClient();
httpClient.setSocketFactory(torClient.getSocketFactory());
Expand Down

0 comments on commit 9d04071

Please sign in to comment.