last merge fix
This commit is contained in:
parent
1e9d1ac3a9
commit
1d2390e1fa
|
@ -57,16 +57,10 @@ public class WorldManager {
|
||||||
this.blockchain = new Blockchain(repository);
|
this.blockchain = new Blockchain(repository);
|
||||||
|
|
||||||
// Initialize PeerData
|
// Initialize PeerData
|
||||||
try {
|
List<PeerData> peerDataList = parsePeerDiscoveryIpList(CONFIG.peerDiscoveryIPList());
|
||||||
InetAddress ip = InetAddress.getByName(CONFIG.peerDiscoveryIP());
|
peers.addAll(peerDataList);
|
||||||
int port = CONFIG.peerDiscoveryPort();
|
|
||||||
PeerData peer = new PeerData(ip.getAddress(), port, new byte[]{00});
|
|
||||||
peers.add(peer);
|
|
||||||
peerDiscovery = new PeerDiscovery(peers);
|
peerDiscovery = new PeerDiscovery(peers);
|
||||||
} catch (UnknownHostException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.wallet = new Wallet();
|
this.wallet = new Wallet();
|
||||||
|
|
||||||
|
@ -192,4 +186,28 @@ public class WorldManager {
|
||||||
public EthereumListener getListener() {
|
public EthereumListener getListener() {
|
||||||
return listener;
|
return listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<PeerData> parsePeerDiscoveryIpList(String peerDiscoveryIpList){
|
||||||
|
|
||||||
|
List<String> ipList = Arrays.asList( peerDiscoveryIpList.split(",") );
|
||||||
|
List<PeerData> peers = new ArrayList<>();
|
||||||
|
|
||||||
|
for (String ip : ipList){
|
||||||
|
String[] addr = ip.trim().split(":");
|
||||||
|
String ip_trim = addr[0];
|
||||||
|
String port_trim = addr[1];
|
||||||
|
|
||||||
|
try {
|
||||||
|
InetAddress iAddr = InetAddress.getByName(ip_trim);
|
||||||
|
int port = Integer.parseInt(port_trim);
|
||||||
|
|
||||||
|
PeerData peerData = new PeerData(iAddr.getAddress(), port, new byte[]{00});
|
||||||
|
peers.add(peerData);
|
||||||
|
} catch (UnknownHostException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return peers;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue