def write_header(self, header, sync=True): if not self.headers_data: self.headers_offset = header.get('block_height') self.headers_data += header_to_string(header).decode('hex') if sync or len(self.headers_data) > 40 * 100: self.flush_headers() with self.cache_lock: chunk_index = header.get('block_height') / BLOCKS_PER_CHUNK if self.chunk_cache.get(chunk_index): self.chunk_cache.pop(chunk_index)
def hash_header(header): return rev_hex(Hash(header_to_string(header).decode('hex')).encode('hex'))
def hash_header(header): return rev_hex( Hash(header_to_string(header).decode('hex')).encode('hex'))