def serialize(self, with_witness=True):
    r = b''
    r += ser_compact_size(self.index)
    if with_witness:
        r += self.tx.serialize_with_witness()
    else:
        r += self.tx.serialize_without_witness()
    return r
def serialize(self, with_witness=True):
    r = b
    r += ser_compact_size(self.index)
    if with_witness:
        r += self.tx.serialize_with_witness()
    else:
        r += self.tx.serialize_without_witness()
    return r