Witness data for a single transaction input
| 271 | |
| 272 | |
| 273 | class 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 | |
| 307 | class CTxWitness(ImmutableSerializable): |
| 308 | """Witness data for all inputs to a transaction""" |
no outgoing calls