def _get_peers_from_dns_seeds(self) -> Sequence[LNPeerAddr]:
    if (not constants.net.LN_DNS_SEEDS):
        return []
    dns_seed = random.choice(constants.net.LN_DNS_SEEDS)
    self.logger.info('asking dns seed "{}" for ln peers'.format(dns_seed))
    try:
        srv_answers = resolve_dns_srv('r{}.{}'.format(constants.net.LN_REALM_BYTE, dns_seed))
    except dns.exception.DNSException as e:
        self.logger.info(f'failed querying (1) dns seed "{dns_seed}" for ln peers: {repr(e)}')
        return []
    random.shuffle(srv_answers)
    num_peers = (2 * NUM_PEERS_TARGET)
    srv_answers = srv_answers[:num_peers]
    peers = []
    for srv_ans in srv_answers:
        try:
            answers = dns.resolver.resolve(srv_ans['host'])
        except dns.exception.DNSException as e:
            self.logger.info(f'failed querying (2) dns seed "{dns_seed}" for ln peers: {repr(e)}')
            continue
        try:
            ln_host = str(answers[0])
            port = int(srv_ans['port'])
            bech32_pubkey = srv_ans['host'].split('.')[0]
            pubkey = get_compressed_pubkey_from_bech32(bech32_pubkey)
            peers.append(LNPeerAddr(ln_host, port, pubkey))
        except Exception as e:
            self.logger.info(f'error with parsing peer from dns seed: {repr(e)}')
            continue
    self.logger.info(f'got {len(peers)} ln peers from dns seed')
    return peers
def _get_peers_from_dns_seeds(self) -> Sequence[LNPeerAddr]:
    if (not constants.net.LN_DNS_SEEDS):
        return []
    dns_seed = random.choice(constants.net.LN_DNS_SEEDS)
    self.logger.info('asking dns seed "{}" for ln peers'.format(dns_seed))
    try:
        srv_answers = resolve_dns_srv('r{}.{}'.format(constants.net.LN_REALM_BYTE, dns_seed))
    except dns.exception.DNSException as e:
        self.logger.info(f'failed querying (1) dns seed "{dns_seed}" for ln peers: {repr(e)}')
        return []
    random.shuffle(srv_answers)
    num_peers = (2 * NUM_PEERS_TARGET)
    srv_answers = srv_answers[:num_peers]
    peers = []
    for srv_ans in srv_answers:
        try:
            answers = dns.resolver.resolve(srv_ans['host'])
        except dns.exception.DNSException as e:
            self.logger.info(f'failed querying (2) dns seed "{dns_seed}" for ln peers: {repr(e)}')
            continue
        try:
            ln_host = str(answers[0])
            port = int(srv_ans['port'])
            bech32_pubkey = srv_ans['host'].split('.')[0]
            pubkey = get_compressed_pubkey_from_bech32(bech32_pubkey)
            peers.append(LNPeerAddr(ln_host, port, pubkey))
        except Exception as e:
            self.logger.info(f'error with parsing peer from dns seed: {repr(e)}')
            continue
    self.logger.info(f'got {len(peers)} ln peers from dns seed')
    return peers