Fix formatting

This commit is contained in:
Christoph Atteneder 2021-09-21 09:09:05 +02:00
parent a6ca8985f3
commit 1dea1a134a
No known key found for this signature in database
GPG key ID: CD5DC1C529CDFD3B

View file

@ -127,12 +127,10 @@ public class BtcNodes {
host = parts[0].replace("[", "").replace("]", "");
if (parts.length == 2)
port = Integer.parseInt(parts[1].replace(":", ""));
}
else if (parts[0].contains(":") && !parts[0].contains(".")) {
} else if (parts[0].contains(":") && !parts[0].contains(".")) {
// IPv6 address only; not delimited by square brackets
host = parts[0];
}
else if (parts[0].contains(".")) {
} else if (parts[0].contains(".")) {
// address and an optional port number
// e.g. 127.0.0.1:8333 or abcdef123xyz.onion:9999
parts = fullAddress.split(":");
@ -142,11 +140,15 @@ public class BtcNodes {
port = Integer.parseInt(parts[1]);
}
checkArgument(host.length()>0, "BtcNode address format not recognised");
checkArgument(host.length() > 0, "BtcNode address format not recognised");
return host.contains(".onion") ? new BtcNode(null, host, null, port, null) : new BtcNode(null, null, host, port, null);
}
public BtcNode(@Nullable String hostName, @Nullable String onionAddress, @Nullable String address, int port, @Nullable String operator) {
public BtcNode(@Nullable String hostName,
@Nullable String onionAddress,
@Nullable String address,
int port,
@Nullable String operator) {
this.hostName = hostName;
this.onionAddress = onionAddress;
this.address = address;