private void visitTree(final ENRTreeLink link, final DNSVisitor visitor) {
    Optional<DNSEntry> optionalEntry = resolveRecord(link.domainName());
    if (optionalEntry.isEmpty()) {
      LOG.trace("No DNS record found for {}", link.domainName());
      return;
    }

    final DNSEntry dnsEntry = optionalEntry.get();
    if (!(dnsEntry instanceof ENRTreeRoot treeRoot)) {
      LOG.debug("Root entry {} is not an ENR tree root", dnsEntry);
      return;
    }

    if (!checkSignature(treeRoot, link.publicKey(), treeRoot.sig())) {
      LOG.debug("ENR tree root {} failed signature check", link.domainName());
      return;
    }
    if (treeRoot.seq() <= seq) {
      LOG.debug("ENR tree root seq {} is not higher than {}, aborting", treeRoot.seq(), seq);
      return;
    }
    seq = treeRoot.seq();

    internalVisit(treeRoot.enrRoot(), link.domainName(), visitor);
    internalVisit(treeRoot.linkRoot(), link.domainName(), visitor);
  }
Reads a complete tree of record, starting with the top-level record.

@param link the ENR link to start with
@param visitor the visitor that will look at each record
ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSResolver.java