Returns an array of witness scripts.
    Each witness will be a bytestring (i.e. encoding the witness script)

def read_tx_witnesses(ptr, tx, num_witnesses):
    """
    Returns an array of witness scripts.
    Each witness will be a bytestring (i.e. encoding the witness script)
    """
    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