@keep_alive('server')
  def signatures_count(self, raw_transaction, prevtx):
    transaction_dict = self.server.decoderawtransaction(raw_transaction)

    prevtx_dict = {}
    for tx in prevtx:
      prevtx_dict["{}#{}".format(tx['txid'], tx['vout'])] = tx['redeemScript']

    has_signatures = 999
    for vin in transaction_dict['vin']:
      redeem_script = prevtx_dict["{}#{}".format(tx['txid'], tx['vout'])]
      try:
        asm = vin['scriptSig']['asm']
      except __HOLE__:
        logging.error('transaction doesn\'t have scriptSig asm')
        continue
      asm_elements = asm.split()
      try:
        asm_script_dict = self.server.decodescript(redeem_script)
        int(asm_script_dict['reqSigs'])
      except KeyError:
        logging.error('script is missing reqSigs field')
        continue
      # first elements is op_zero, last is script, rest is signatuers
      asm_signatures = asm_elements[1:-1]

      # if tried to sign a tx with the same signature again, the sig will equal '0', and we should ignore it
      current_signatures = 0
      for a in asm_signatures:
        if a != '0':
          current_signatures += 1
      has_signatures = min(has_signatures, current_signatures)
    return has_signatures
dataset/ETHPy150Open orisi/orisi/src/shared/bitcoind_client/bitcoinclient.py/BitcoinClient.signatures_count