Returns an array of witness scripts.
    Each witness will be a bytestring (i.e. encoding the witness script)
164925
def read_tx_witnesses(ptr, tx, num_witnesses):
    
    witnesses = []
    for i in xrange(0, num_witnesses):

        witness_stack_len = read_var_int(ptr, tx)
        witness_stack = []

        for j in xrange(0, witness_stack_len):

            stack_item = read_var_string(ptr, tx)
            witness_stack.append(stack_item)
             
        witness_script = btc_witness_script_serialize(witness_stack).decode('hex')
        witnesses.append(witness_script)

    return witnesses
6271
def to_s
      ary = ["\x00", @buffer.dup, "\xff"]

      ary.collect{ |s| s.force_encoding('UTF-8') if s.respond_to?(:force_encoding) }

      return ary.join
    end
485047
def serialize_witness_format
      buf = [version, MARKER, FLAG].pack('Vcc')
      buf << Bitcoin.pack_var_int(inputs.length) << inputs.map(&:to_payload).join
      buf << Bitcoin.pack_var_int(outputs.length) << outputs.map(&:to_payload).join
      buf << witness_payload << [lock_time].pack('V')
      buf
    end
443471
def to_array(self):
        
        array = super(MessageEntity, self).to_array()
        array['type'] = u(self.type)  # py2: type unicode, py3: type str

        array['offset'] = int(self.offset)  # type int
        array['length'] = int(self.length)  # type int
        if self.url is not None:
            array['url'] = u(self.url)  # py2: type unicode, py3: type str

        if self.user is not None:
            array['user'] = self.user.to_array()  # type User

        return array
1088898
def to_array(self):
        
        array = super(PassportElementErrorFiles, self).to_array()
        array['source'] = u(self.source)  # py2: type unicode, py3: type str
        array['type'] = u(self.type)  # py2: type unicode, py3: type str
        array['file_hashes'] = self._as_array(self.file_hashes)  # type list of str
        array['message'] = u(self.message)  # py2: type unicode, py3: type str
        return array
102068
def make_multisig_segwit_address_from_witness_script(script):
    
    script_hash = hashing.bin_sha256(script.decode('hex')).encode('hex')
    scriptsig_script = '0020' + script_hash
    addr = btc_make_p2sh_address(scriptsig_script)
    return addr
272546
def get_witness_for_key_prefix(db, node_hash, key):
    
    validate_is_bytes(key)

    return tuple(_get_witness_for_key_prefix(db, node_hash, encode_to_bin(key)))
408172
def listscripts(self):
        
        code, data, listing = self.__send_command(
            "LISTSCRIPTS", withcontent=True)
        if code == "NO":
            return None
        ret = []
        active_script = None
        for l in listing.splitlines():
            if self.__size_expr.match(l):
                continue
            m = re.match(br'"([^"]+)"\s*(.+)', l)
            if m is None:
                ret += [l.strip(b'"').decode("utf-8")]
                continue
            script = m.group(1).decode("utf-8")
            if self.__active_expr.match(m.group(2)):
                active_script = script
                continue
            ret += [script]
        self.__dprint(ret)
        return (active_script, ret)
1262299
def _ser_script_to_sh_address(script_bytes, witness=False, cashaddr=True):
    '''
    
    '''
    if witness:
        script_hash = utils.sha256(script_bytes)
    else:
        script_hash = utils.hash160(script_bytes)
    return _hash_to_sh_address(
        script_hash=script_hash,
        witness=witness,
        cashaddr=cashaddr)
1175065
def get_matching_indices pattern
      matches = []
      @obj.content.each_with_index { |e,i| 
        # convert to string for tables
        e = e.to_s unless e.is_a? String
        if e  =~ /#{pattern}/
          matches << i
        end
      }
      return matches
    end
1197379
public List<String> getScript(InputStream scriptFileStream) {
		List<String> sqlList = new SqlScriptReader().getSQLList(scriptFileStream);

		return sqlList;
	}
483761
function getScripts(chunks) {
  let scripts = [];

  // Used when skipping the build, short-circuit to return metadata
  if (chunks.metadata) {
    return chunks.metadata;
  }

  sorter.dependency(chunks).forEach((chunk) => {
    scripts.push({
      name: chunk.files[0]
    });
  });

  return scripts;
}
358102
public List<String> getScript(String scriptName) {
		String scriptFilename = this.scriptMap.get(scriptName);
		InputStream scriptFileStream = FileUtils.getFileInputStream(scriptFilename);
		
		List<String> sqlList = new SqlScriptReader().getSQLList(scriptFileStream);

		return sqlList;
	}
660780
def p2wpkh_input_and_witness(outpoint, sig, pubkey, sequence=0xFFFFFFFE):
    '''
    
    '''
    return tb.make_witness_input_and_witness(
        outpoint=outpoint,
        sequence=sequence,
        stack=[bytes.fromhex(sig), bytes.fromhex(pubkey)])
444966
def to_array(self):
        
        array = super(PassportElementErrorReverseSide, self).to_array()
        array['source'] = u(self.source)  # py2: type unicode, py3: type str
        array['type'] = u(self.type)  # py2: type unicode, py3: type str
        array['file_hash'] = u(self.file_hash)  # py2: type unicode, py3: type str
        array['message'] = u(self.message)  # py2: type unicode, py3: type str
        return array
506386
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
1098203
def record(self):
        

        modules = []
        scripts = []
        if self.get_content_of_file('RECORD'):
            lines = self.get_content_of_file('RECORD').splitlines()
            for line in lines:
                if 'dist-info' in line or '/' not in line:
                    continue
                elif '.data/scripts' in line:
                    script = line.split(',', 1)[0]
                    # strip Name.version.data/scripts/
                    scripts.append(re.sub('.*/.*/', '', script))
                else:
                    # strip everything from first occurance of slash
                    modules.append(re.sub('/.*', '', line))

        return {'modules': sorted(set(modules)),
                'scripts': sorted(set(scripts))}