<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def index_discovered_zonefiles(self, lastblock):
 """ Go through the list of zone files we discovered via Atlas, grouped by name and ordered by block height. Find all subsequent zone files for this name, and process all subdomain operations contained within them. """

        all_queued_zfinfos = []         # contents of the queue
        subdomain_zonefile_infos = {}   # map subdomain fqn to list of zonefile info bundles, for process_subdomains
        name_blocks = {}                # map domain name to the block at which we should reprocess its subsequent zone files

        offset = 0

        while True:
            queued_zfinfos = queuedb_findall(self.subdomain_queue_path, "zonefiles", limit=100, offset=offset)
            if len(queued_zfinfos) == 0:
                # done!
                break
            
            offset += 100
            all_queued_zfinfos += queued_zfinfos

            if len(all_queued_zfinfos) >= 1000:
                # only do so many zone files per block, so we don't stall the node
                break
        
        log.debug("Discovered {} zonefiles".format(len(all_queued_zfinfos)))

        for queued_zfinfo in all_queued_zfinfos:
            zfinfo = json.loads(queued_zfinfo['data'])

            zonefile_hash = zfinfo['zonefile_hash']
            block_height = zfinfo['block_height']

            # find out the names that sent this zone file at this block
            zfinfos = atlasdb_get_zonefiles_by_hash(zonefile_hash, block_height=block_height, path=self.atlasdb_path)
            if zfinfos is None:
                log.warn("Absent zonefile {}".format(zonefile_hash))
                continue
            
            # find out for each name block height at which its zone file was discovered.
            # this is where we'll begin looking for more subdomain updates.
            for zfi in zfinfos:
                if zfi['name'] not in name_blocks:
                    name_blocks[zfi['name']] = block_height
                else:
                    name_blocks[zfi['name']] = min(block_height, name_blocks[zfi['name']])
      
        for name in name_blocks:
            if name_blocks[name] >= lastblock:
                continue

            log.debug("Finding subdomain updates for {} at block {}".format(name, name_blocks[name]))
            
            # get the subdomains affected at this block by finding the zonefiles created here.
            res = self.find_zonefile_subdomains(name_blocks[name], lastblock, name=name)
            zonefile_subdomain_info = res['zonefile_info']
            subdomain_index = res['subdomains']
            
            # for each subdomain, find the list of zonefiles that contain records for it
            for fqn in subdomain_index:
                if fqn not in subdomain_zonefile_infos:
                    subdomain_zonefile_infos[fqn] = []

                for i in subdomain_index[fqn]:
                    subdomain_zonefile_infos[fqn].append(zonefile_subdomain_info[i])
           
        processed = []
        for fqn in subdomain_zonefile_infos:
            subseq = filter(lambda szi: szi['zonefile_hash'] not in processed, subdomain_zonefile_infos[fqn])
            if len(subseq) == 0:
                continue

            log.debug("Processing {} zone file entries found for {} and others".format(len(subseq), fqn))

            subseq.sort(cmp=lambda z1, z2: -1 if z1['block_height'] < z2['block_height'] else 0 if z1['block_height'] == z2['block_height'] else 1)
            self.process_subdomains(subseq)
            processed += [szi['zonefile_hash'] for szi in subseq]

        # clear queue 
        queuedb_removeall(self.subdomain_queue_path, all_queued_zfinfos)
        return True