private void SendKnownAddresses(BitcoinEndpoint endpoint) { List<NetAddr> addresses = new List<NetAddr>(); List<NodeConnection> currentConnections = connectionCollection.GetConnections(); foreach (NodeConnection connection in currentConnections) { //todo: filter loopback addresses NetAddr addr = new NetAddr( //todo: use last message date instead (uint) connection.Endpoint.PeerInfo.VersionMessage.Timestamp, connection.Endpoint.PeerInfo.VersionMessage.Services, endpoint.PeerInfo.IpEndpoint.Address, (ushort) endpoint.PeerInfo.IpEndpoint.Port); addresses.Add(addr); } AddrMessage addrMessage = new AddrMessage(addresses.Take(AddrMessage.MaxAddressesPerMessage).ToArray()); endpoint.WriteMessage(addrMessage); }
public AddrMessage(NetAddr[] addressList) { this.addressList = addressList; }