mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Add method for localhost bitcoin node configPeerNodesForLocalHostBitcoinNode
This commit is contained in:
parent
839ade1f4d
commit
0e77361d96
2 changed files with 21 additions and 8 deletions
|
@ -45,8 +45,10 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.*;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.channels.FileLock;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -462,6 +464,17 @@ public class WalletConfig extends AbstractIdleService {
|
|||
}
|
||||
}
|
||||
|
||||
void setPeerNodesForLocalHost() {
|
||||
try {
|
||||
setPeerNodes(new PeerAddress(InetAddress.getLocalHost(), params.getPort()));
|
||||
} catch (UnknownHostException e) {
|
||||
log.error(e.toString());
|
||||
e.printStackTrace();
|
||||
// Borked machine with no loopback adapter configured properly.
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private Wallet createOrLoadWallet(File walletFile, boolean shouldReplayWallet,
|
||||
BisqKeyChainGroup keyChainGroup, boolean isBsqWallet, DeterministicSeed restoreFromSeed)
|
||||
throws Exception {
|
||||
|
|
|
@ -201,6 +201,8 @@ public class WalletsSetup {
|
|||
|
||||
if (params == RegTestParams.get()) {
|
||||
configPeerNodesForRegTest();
|
||||
} else if (bisqEnvironment.isBitcoinLocalhostNodeRunning()) {
|
||||
configPeerNodesForLocalHostBitcoinNode();
|
||||
} else {
|
||||
configPeerNodes(socks5Proxy);
|
||||
}
|
||||
|
@ -287,17 +289,15 @@ public class WalletsSetup {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
} else if (regTestHost == RegTestHost.LOCALHOST) {
|
||||
try {
|
||||
walletConfig.setPeerNodes(new PeerAddress(InetAddress.getLocalHost(), params.getPort()));
|
||||
} catch (UnknownHostException e) {
|
||||
log.error(e.toString());
|
||||
e.printStackTrace();
|
||||
// Borked machine with no loopback adapter configured properly.
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
walletConfig.setPeerNodesForLocalHost();
|
||||
}
|
||||
}
|
||||
|
||||
private void configPeerNodesForLocalHostBitcoinNode() {
|
||||
walletConfig.setMinBroadcastConnections(1);
|
||||
walletConfig.setPeerNodesForLocalHost();
|
||||
}
|
||||
|
||||
private void configPeerNodes(Socks5Proxy socks5Proxy) {
|
||||
List<BitcoinNodes.BtcNode> btcNodeList = new ArrayList<>();
|
||||
walletConfig.setMinBroadcastConnections((int) Math.floor(DEFAULT_CONNECTIONS * 0.8));
|
||||
|
|
Loading…
Add table
Reference in a new issue