mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-22 14:22:45 +01:00
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:
parent
e76b28a8ca
commit
4a45c3b4f4
1 changed files with 4 additions and 1 deletions
|
@ -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(",");
|
||||
|
|
Loading…
Add table
Reference in a new issue