An encoding of the data elements on the initial stack for (segregated witness)
| 811 | return n |
| 812 | |
| 813 | class CScriptWitness(ImmutableSerializable): |
| 814 | """An encoding of the data elements on the initial stack for (segregated |
| 815 | witness) |
| 816 | """ |
| 817 | __slots__ = ['stack'] |
| 818 | |
| 819 | def __init__(self, stack=()): |
| 820 | object.__setattr__(self, 'stack', stack) |
| 821 | |
| 822 | def __len__(self): |
| 823 | return len(self.stack) |
| 824 | |
| 825 | def __iter__(self): |
| 826 | return iter(self.stack) |
| 827 | |
| 828 | def __repr__(self): |
| 829 | return 'CScriptWitness(' + ','.join("x('%s')" % bitcoin.core.b2x(s) for s in self.stack) + ')' |
| 830 | |
| 831 | def is_null(self): |
| 832 | return len(self.stack) == 0 |
| 833 | |
| 834 | @classmethod |
| 835 | def stream_deserialize(cls, f): |
| 836 | n = VarIntSerializer.stream_deserialize(f) |
| 837 | stack = tuple(BytesSerializer.stream_deserialize(f) for i in range(n)) |
| 838 | return cls(stack) |
| 839 | |
| 840 | def stream_serialize(self, f): |
| 841 | VarIntSerializer.stream_serialize(len(self.stack), f) |
| 842 | for s in self.stack: |
| 843 | BytesSerializer.stream_serialize(s, f) |
| 844 | |
| 845 | |
| 846 | SIGHASH_ALL = 1 |
no outgoing calls