<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _add_blockhash_to_state_changes(storage: SQLiteStorage, cache: BlockHashCache) -> None: """Adds blockhash to ContractReceiveXXX and ActionInitChain state changes"""


    batch_size = 50
    batch_query = storage.batch_query_state_changes(
        batch_size=batch_size,
        filters=[
            ('_type', 'raiden.transfer.state_change.ContractReceive%'),
            ('_type', 'raiden.transfer.state_change.ActionInitChain'),
        ],
        logical_and=False,
    )
    for state_changes_batch in batch_query:
        # Gather query records to pass to gevent pool imap to have concurrent RPC calls
        query_records = []
        for state_change in state_changes_batch:
            data = json.loads(state_change.data)
            assert 'block_hash' not in data, 'v18 state changes cant contain blockhash'
            record = BlockQueryAndUpdateRecord(
                block_number=int(data['block_number']),
                data=data,
                state_change_identifier=state_change.state_change_identifier,
                cache=cache,
            )
            query_records.append(record)

        # Now perform the queries in parallel with gevent.Pool.imap and gather the
        # updated tuple entries that will update the DB
        updated_state_changes = []
        pool_generator = Pool(batch_size).imap(
            _query_blocknumber_and_update_statechange_data,
            query_records,
        )
        for entry in pool_generator:
            updated_state_changes.append(entry)

        # Finally update the DB with a batched executemany()
        storage.update_state_changes(updated_state_changes)