code: def _transform_snapshot(
          raw_snapshot: str,
          storage: SQLiteStorage,
          cache: BlockHashCache,
  ) -> str:
      
      snapshot = json.loads(raw_snapshot)
      block_number = int(snapshot['block_number'])
      snapshot['block_hash'] = cache.get(block_number)
  
      pending_transactions = snapshot['pending_transactions']
      new_pending_transactions = []
      for transaction_data in pending_transactions:
          if 'raiden.transfer.events.ContractSend' not in transaction_data['_type']:
              raise InvalidDBData(
                  "Error during v18 -> v19 upgrade. Chain state's pending transactions "
                  "should only contain ContractSend transactions",
              )
  
          # For each pending transaction find the corresponding DB event record.
          event_record = storage.get_latest_event_by_data_field(
              filters=transaction_data,
          )
          if not event_record.data:
              raise InvalidDBData(
                  'Error during v18 -> v19 upgrade. Could not find a database event '
                  'table entry for a pending transaction.',
              )
  
          event_record_data = json.loads(event_record.data)
          transaction_data['triggered_by_block_hash'] = event_record_data['triggered_by_block_hash']
          new_pending_transactions.append(transaction_data)
  
      snapshot['pending_transactions'] = new_pending_transactions
      return json.dumps(snapshot)
docs: Upgrades a single snapshot by adding the blockhash to it and to any pending transactions