Don't use SeedPeers for testnet

This commit is contained in:
Manfred Karrer 2017-11-09 17:57:44 -05:00
parent 17bb2ae974
commit a4136631ed
No known key found for this signature in database
GPG Key ID: 401250966A6B2C46
3 changed files with 9 additions and 3 deletions

View File

@ -57,7 +57,7 @@ public class BitcoinNodes {
}
public boolean useProvidedBtcNodes() {
return BisqEnvironment.getBaseCurrencyNetwork().isBitcoin() && BisqEnvironment.getBaseCurrencyNetwork().isBitcoin();
return BisqEnvironment.getBaseCurrencyNetwork().isBitcoin() && BisqEnvironment.getBaseCurrencyNetwork().isMainnet();
}
@Getter

View File

@ -177,6 +177,10 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
selectedBitcoinNodesOption = BitcoinNodes.BitcoinNodesOption.PROVIDED;
preferences.setBitcoinNodesOptionOrdinal(selectedBitcoinNodesOption.ordinal());
}
if (!bitcoinNodes.useProvidedBtcNodes()) {
selectedBitcoinNodesOption = BitcoinNodes.BitcoinNodesOption.PUBLIC;
preferences.setBitcoinNodesOptionOrdinal(selectedBitcoinNodesOption.ordinal());
}
selectBitcoinPeersToggle();
onBitcoinPeersToggleSelected(false);
@ -378,7 +382,7 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
btcNodesLabel.setDisable(true);
if (calledFromUser)
showShutDownPopup();
}else{
} else {
selectedBitcoinNodesOption = BitcoinNodes.BitcoinNodesOption.PUBLIC;
preferences.setBitcoinNodesOptionOrdinal(selectedBitcoinNodesOption.ordinal());
selectBitcoinPeersToggle();

View File

@ -23,6 +23,7 @@ import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.net.discovery.PeerDiscovery;
import org.bitcoinj.net.discovery.PeerDiscoveryException;
import org.bitcoinj.net.discovery.SeedPeers;
import org.bitcoinj.params.MainNetParams;
import java.net.InetSocketAddress;
import java.util.ArrayList;
@ -59,7 +60,8 @@ public class Socks5MultiDiscovery implements PeerDiscovery {
if ((mode & SOCKS5_DISCOVER_ONION) != 0)
discoveryList.add(new Socks5SeedOnionDiscovery(proxy, params));
if ((mode & SOCKS5_DISCOVER_ADDR) != 0)
// Testnet has no addrSeeds so SeedPeers is not supported (would throw a nullPointer)
if ((mode & SOCKS5_DISCOVER_ADDR) != 0 && params == MainNetParams.get())
// note: SeedPeers does not perform any network operations, so does not use proxy.
discoveryList.add(new SeedPeers(params));