MCPcopy
hub / github.com/petertodd/python-bitcoinlib / CScriptWitness

Class CScriptWitness

bitcoin/core/script.py:813–843  ·  view source on GitHub ↗

An encoding of the data elements on the initial stack for (segregated witness)

Source from the content-addressed store, hash-verified

811 return n
812
813class 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
846SIGHASH_ALL = 1

Callers 4

spend-p2wpkh.pyFile · 0.90
__init__Method · 0.85
test_checkblockMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_checkblockMethod · 0.68