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

Class CTxInWitness

bitcoin/core/__init__.py:273–305  ·  view source on GitHub ↗

Witness data for a single transaction input

Source from the content-addressed store, hash-verified

271
272
273class CTxInWitness(ImmutableSerializable):
274 """Witness data for a single transaction input"""
275 __slots__ = ['scriptWitness']
276
277 def __init__(self, scriptWitness=CScriptWitness()):
278 object.__setattr__(self, 'scriptWitness', scriptWitness)
279
280 def is_null(self):
281 return self.scriptWitness.is_null()
282
283 @classmethod
284 def stream_deserialize(cls, f):
285 scriptWitness = CScriptWitness.stream_deserialize(f)
286 return cls(scriptWitness)
287
288 def stream_serialize(self, f):
289 self.scriptWitness.stream_serialize(f)
290
291 def __repr__(self):
292 return "CTxInWitness(%s)" % (repr(self.scriptWitness))
293
294 @classmethod
295 def from_txinwitness(cls, txinwitness):
296 """Create an immutable copy of an existing TxInWitness
297
298 If txin is already immutable (txin.__class__ is CTxIn) it is returned
299 directly.
300 """
301 if txinwitness.__class__ is CTxInWitness:
302 return txinwitness
303
304 else:
305 return cls(txinwitness.scriptWitness)
306
307class CTxWitness(ImmutableSerializable):
308 """Witness data for all inputs to a transaction"""

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