WalletTool: set peer address for RegTest network

On RegTest we need to add the `localhost` peer address to the
`PeerGroup` and set max connections to 1, to avoid calling peer
discovery.
This commit is contained in:
Sean Gilligan 2023-06-06 17:06:38 -07:00 committed by Andreas Schildbach
parent e76b28a8ca
commit 4a45c3b4f4

View file

@ -1009,8 +1009,11 @@ public class WalletTool implements Callable<Integer> {
peerGroup = new PeerGroup(net, chain);
}
peerGroup.setUserAgent("WalletTool", "1.0");
if (net == BitcoinNetwork.REGTEST)
if (net == BitcoinNetwork.REGTEST) {
peerGroup.addAddress(PeerAddress.localhost(params));
peerGroup.setMinBroadcastConnections(1);
peerGroup.setMaxConnections(1);
}
peerGroup.addWallet(wallet);
if (peersStr != null) {
String[] peerAddrs = peersStr.split(",");