def verify_chunk(self, index, chunk):
        height = index*2016
        num = len(chunk)/80

        if index == 0:  
            prev_hash = ("0"*64)
        else:
            prev_header = self.store.read_header(index*2016-1)
            if prev_header is None:
                raise
            prev_hash = self.hash_header(self.store.header_to_raw(prev_header))

        bits, target = self.get_target(index)

        for i in range(num):
            raw_header = chunk[i*80:(i+1)*80]
            header = self.store.header_from_raw(raw_header)
            _hash = self.hash_header(raw_header)

            assert prev_hash == header.get('prev_block_hash')
            try:
                assert bits == header.get('bits')
                assert int('0x'+_hash, 16) < target
            except __HOLE__:
                if self.testnet and header.get('timestamp') - prev_header.get('timestamp') > 1200:
                    assert self.max_bits == header.get('bits')
                    assert int('0x'+_hash, 16) < self.max_target
                else:
                    raise

            prev_header = header
            prev_hash = _hash
dataset/ETHPy150Open chromaway/ngcccbase/ngcccbase/blockchain.py/BlockHashingAlgorithm.verify_chunk