| 760 | |
| 761 | |
| 762 | class CTxWitness: |
| 763 | __slots__ = ("vtxinwit", "vtxoutwit") |
| 764 | |
| 765 | def __init__(self): |
| 766 | self.vtxinwit = [] |
| 767 | self.vtxoutwit = [] |
| 768 | |
| 769 | def deserialize(self, f): |
| 770 | for i in range(len(self.vtxinwit)): |
| 771 | self.vtxinwit[i].deserialize(f) |
| 772 | for i in range(len(self.vtxoutwit)): |
| 773 | self.vtxoutwit[i].deserialize(f) |
| 774 | |
| 775 | def serialize(self): |
| 776 | r = b"" |
| 777 | # This is different than the usual vector serialization -- |
| 778 | # we omit the length of the vector, which is required to be |
| 779 | # the same length as the transaction's vin vector. |
| 780 | for x in self.vtxinwit: |
| 781 | r += x.serialize() |
| 782 | for x in self.vtxoutwit: |
| 783 | r += x.serialize() |
| 784 | return r |
| 785 | |
| 786 | def __repr__(self): |
| 787 | return "CTxWitness([%s], [%s])" % \ |
| 788 | (';'.join([repr(x) for x in self.vtxinwit]), |
| 789 | ';'.join([repr(x) for x in self.vtxoutwit])) |
| 790 | |
| 791 | def is_null(self): |
| 792 | for x in self.vtxinwit: |
| 793 | if not x.is_null(): |
| 794 | return False |
| 795 | for x in self.vtxoutwit: |
| 796 | if not x.is_null(): |
| 797 | return False |
| 798 | return True |
| 799 | |
| 800 | |
| 801 | class CTransaction: |
no outgoing calls