| 728 | |
| 729 | |
| 730 | class CTxOutWitness: |
| 731 | __slots__ = ("vchSurjectionproof", "vchRangeproof") |
| 732 | |
| 733 | def __init__(self): |
| 734 | self.vchSurjectionproof = b'' |
| 735 | self.vchRangeproof = b'' |
| 736 | |
| 737 | def deserialize(self, f): |
| 738 | self.vchSurjectionproof = deser_string(f) |
| 739 | self.vchRangeproof = deser_string(f) |
| 740 | |
| 741 | def serialize(self): |
| 742 | r = b'' |
| 743 | r += ser_string(self.vchSurjectionproof) |
| 744 | r += ser_string(self.vchRangeproof) |
| 745 | return r |
| 746 | |
| 747 | def calc_witness_hash(self): |
| 748 | leaves = [ |
| 749 | hash256(ser_string(self.vchSurjectionproof))[::-1].hex(), |
| 750 | hash256(ser_string(self.vchRangeproof))[::-1].hex() |
| 751 | ] |
| 752 | return calcfastmerkleroot(leaves) |
| 753 | |
| 754 | def __repr__(self): |
| 755 | return "CTxOutWitness (%s, %s)" % (self.vchSurjectionproof, self.vchRangeproof) |
| 756 | |
| 757 | def is_null(self): |
| 758 | return len(self.vchSurjectionproof) == 0 \ |
| 759 | and len(self.vchRangeproof) == 0 |
| 760 | |
| 761 | |
| 762 | class CTxWitness: |
no outgoing calls