Use localhost port ending in net id digit

Otherwise ``SeedNodesRepository`` ignores the address and peers fail to connect to the seed node.
This commit is contained in:
Ivan Vilata-i-Balaguer 2016-04-26 13:44:47 +02:00
parent 59f66f8ef9
commit fe9b3ec5f6

View File

@ -114,7 +114,13 @@ public class NetworkStressTest {
@NotNull
private static NodeAddress getSeedNodeAddress() {
return new NodeAddress("localhost", Utils.findFreeSystemPort());
// The address is only considered by ``SeedNodesRepository`` if
// it ends in the digit matching the network identifier.
int port;
do {
port = Utils.findFreeSystemPort();
} while (port % 10 != REGTEST_NETWORK_ID);
return new NodeAddress("localhost", port);
}
@NotNull