Prevent connection to localhost bitcoin node if dao testnet is used (fix)

This commit is contained in:
Manfred Karrer 2019-02-21 12:25:48 -05:00
parent 518fe724d9
commit 0561c12a90
No known key found for this signature in database
GPG key ID: 401250966A6B2C46

View file

@ -209,9 +209,12 @@ public class WalletConfig extends AbstractIdleService {
} }
private PeerGroup createPeerGroup() { private PeerGroup createPeerGroup() {
PeerGroup peerGroup;
// no proxy case. // no proxy case.
if (socks5Proxy == null) { if (socks5Proxy == null) {
return new PeerGroup(params, vChain); peerGroup = new PeerGroup(params, vChain);
// For dao testnet (server side regtest) we prevent to connect to a localhost node to avoid confusion
// if local btc node is not synced with our dao testnet master node.
} else { } else {
// proxy case (tor). // proxy case (tor).
Proxy proxy = new Proxy(Proxy.Type.SOCKS, Proxy proxy = new Proxy(Proxy.Type.SOCKS,
@ -224,10 +227,11 @@ public class WalletConfig extends AbstractIdleService {
new BlockingClientManager() : new BlockingClientManager() :
new BlockingClientManager(proxySocketFactory); new BlockingClientManager(proxySocketFactory);
PeerGroup peerGroup = new PeerGroup(params, vChain, blockingClientManager); peerGroup = new PeerGroup(params, vChain, blockingClientManager);
blockingClientManager.setConnectTimeoutMillis(TIMEOUT); blockingClientManager.setConnectTimeoutMillis(TIMEOUT);
peerGroup.setConnectTimeoutMillis(TIMEOUT); peerGroup.setConnectTimeoutMillis(TIMEOUT);
}
// For dao testnet (server side regtest) we prevent to connect to a localhost node to avoid confusion // For dao testnet (server side regtest) we prevent to connect to a localhost node to avoid confusion
// if local btc node is not synced with our dao testnet master node. // if local btc node is not synced with our dao testnet master node.
@ -236,7 +240,6 @@ public class WalletConfig extends AbstractIdleService {
return peerGroup; return peerGroup;
} }
}
/** /**
* Will only connect to the given addresses. Cannot be called after startup. * Will only connect to the given addresses. Cannot be called after startup.