def run(self):
        self.headers = open(HEADERS_FILE, 'ab+').read()

        with self.lock:
            self.running = True

        run_time = time.time()
        while self.is_running():
            if run_time > time.time():
                time.sleep(0.05)
                continue
            run_time = time.time() + 1
            
            try:
                blockchainstate = BlockchainState.from_url(None, testnet)
                height = blockchainstate.get_block_count()
                if height == self.height:
                    continue
                if self.height < height:
                    self.headers = self.headers[:height*80]
                while height > self.height:
                    if not self.is_running():
                        break
                    block_height = self.height + 1
                    blockhash = blockchainstate.get_block_hash(block_height)
                    block = blockchainstate.get_block(blockhash)

                    if block_height == 0:
                        self.headers = self._header_to_string(block)
                    else:
                        prev_hash = self._hash_header(self.headers[-80:])
                        if prev_hash == block['previousblockhash']:
                            self.headers += self._header_to_string(block)
                        else:
                            self.headers = self.headers[:-80]
                open(HEADERS_FILE, 'wb').write(self.headers)
            except httplib.BadStatusLine:
                pass # bad connection, try again later
            except SocketError:
                pass # bad connection, try again later
            except JSONRPCException as e:
                if e.error["code"] != -28:
                    raise # Not error we are looking for
                pass # Loading block index... , try again later
dataset/ETHPy150Open chromaway/ngcccbase/chromanode.py/ChunkThread.run/swapped operands of `<`