public Task DiscoveryAsync() { var copiedPath = CopyPoaFile(); var poaPeers = JsonConvert.DeserializeObject <List <PoaPeer> >(File.ReadAllText(copiedPath)); foreach (var peer in poaPeers.Select(poaPeer => new Peer { IsPoaNode = true, PeerId = poaPeer.ToPeerId() })) { //Don't add your own peer id even if you are a POA node. if (_peerSettings.PeerId == peer.PeerId) { continue; } _logger.Information( $"Adding POA Peer: {peer.PeerId.IpAddress} Public Key: {peer.PeerId.PublicKey.KeyToString()}"); if (!_peerRepository.Exists(peer.DocumentId)) { _peerRepository.Add(peer); } } return(Task.CompletedTask); }
public Task DiscoveryAsync() { var copiedPath = CopyPoaFile(); var poaPeers = JsonConvert.DeserializeObject <List <PoaPeer> >(File.ReadAllText(copiedPath)); foreach (var peer in poaPeers.Select(poaPeer => new Peer { PeerId = poaPeer.ToPeerId() })) { _logger.Information( $"Adding POA Peer: {peer.PeerId.IpAddress} Public Key: {peer.PeerId.PublicKey.KeyToString()}"); if (!_peerRepository.Exists(peer.DocumentId)) { _peerRepository.Add(peer); } } return(Task.CompletedTask); }