def verify_chain(self, chain):
        prev_header = self.store.read_header(chain[0].get('block_height')-1)
        prev_hash = self.hash_header(self.store.header_to_raw(prev_header))

        for header in chain:
            bits, target = self.get_target(header.get('block_height')/2016, chain)
            _hash = self.hash_header(self.store.header_to_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_chain