3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-07 14:54:15 +00:00

Add a PeerGroup.connectToLocalhost helper method.

This commit is contained in:
Mike Hearn 2014-05-04 23:18:51 +02:00
parent 4df728a7d9
commit 28c16738bc

View File

@ -956,6 +956,16 @@ public class PeerGroup extends AbstractExecutionThreadService implements Transac
return connectTo(peerAddress, true);
}
/**
* Helper for forcing a connection to localhost. Useful when using regtest mode. Returns the peer object.
*/
@Nullable
public Peer connectToLocalHost() {
final PeerAddress localhost = PeerAddress.localhost(params);
backoffMap.put(localhost, new ExponentialBackoff(peerBackoffParams));
return connectTo(localhost, true);
}
// Internal version.
@Nullable
protected Peer connectTo(PeerAddress address, boolean incrementMaxConnections) {