mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 18:03:12 +01:00
Allow tor to be used on regtest
This allows for a tor .onion address to be specified as the bitcoinRegtestHost parameter and, as long as the --useTorForBtc=true parameter is included, it will use tor when on regtest.
This commit is contained in:
parent
bf94810126
commit
53cf14791f
@ -236,7 +236,6 @@ public class WalletsSetup {
|
||||
if (regTestHost == RegTestHost.LOCALHOST) {
|
||||
walletConfig.setPeerNodesForLocalHost();
|
||||
} else if (regTestHost == RegTestHost.REMOTE_HOST) {
|
||||
walletConfig.setMinBroadcastConnections(1);
|
||||
configPeerNodesForRegTestServer();
|
||||
} else {
|
||||
configPeerNodes(socks5Proxy);
|
||||
@ -315,7 +314,11 @@ public class WalletsSetup {
|
||||
|
||||
private void configPeerNodesForRegTestServer() {
|
||||
try {
|
||||
walletConfig.setPeerNodes(new PeerAddress(InetAddress.getByName(RegTestHost.HOST), params.getPort()));
|
||||
if (RegTestHost.HOST.endsWith(".onion")) {
|
||||
walletConfig.setPeerNodes(new PeerAddress(RegTestHost.HOST, params.getPort()));
|
||||
} else {
|
||||
walletConfig.setPeerNodes(new PeerAddress(InetAddress.getByName(RegTestHost.HOST), params.getPort()));
|
||||
}
|
||||
} catch (UnknownHostException e) {
|
||||
log.error(e.toString());
|
||||
e.printStackTrace();
|
||||
|
@ -692,10 +692,12 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
|
||||
}
|
||||
|
||||
public boolean getUseTorForBitcoinJ() {
|
||||
// We override the useTorForBitcoinJ and set it to false if we detected a localhost node or if we are not on mainnet.
|
||||
// At testnet there are very few Bitcoin tor nodes and we don't provide tor nodes.
|
||||
if (!BisqEnvironment.getBaseCurrencyNetwork().isMainnet()
|
||||
// We override the useTorForBitcoinJ and set it to false if we detected a localhost node or if we are not on mainnet,
|
||||
// unless the useTorForBtc parameter is explicitly provided.
|
||||
// On testnet there are very few Bitcoin tor nodes and we don't provide tor nodes.
|
||||
if ((!BisqEnvironment.getBaseCurrencyNetwork().isMainnet()
|
||||
|| bisqEnvironment.isBitcoinLocalhostNodeRunning())
|
||||
&& bisqEnvironment.getProperty(BtcOptionKeys.USE_TOR_FOR_BTC).isEmpty())
|
||||
return false;
|
||||
else
|
||||
return prefPayload.isUseTorForBitcoinJ();
|
||||
|
Loading…
Reference in New Issue
Block a user