code: def GetScriptHashesForVerifying(self):
          
          if not self.References and len(self.Attributes) < 1:
              return []
  
          hashes = set()
          for coinref, output in self.References.items():
              hashes.add(output.ScriptHash)
  
          for attr in self.Attributes:
              if attr.Usage == TransactionAttributeUsage.Script:
                  if type(attr.Data) is UInt160:
                      hashes.add(attr.Data)
                  else:
                      hashes.add(UInt160(data=attr.Data))
  
          for key, group in groupby(self.outputs, lambda p: p.AssetId):
              if self.raw_tx:
                  asset = Helper.StaticAssetState(key)
              else:
                  asset = GetBlockchain().GetAssetState(key.ToBytes())
              if asset is None:
                  raise Exception("Invalid operation")
  
              if asset.AssetType == AssetType.DutyFlag:
                  for p in group:
                      hashes.add(p.ScriptHash)
  
          hashlist = list(hashes)
          hashlist.sort()
          return hashlist
docs: Get a list of script hashes for verifying transactions.
  
          Raises:
              Exception: if there are no valid assets in the transaction.
  
          Returns:
              list: of UInt160 type script hashes.