| 487 | self.nSequence, self.m_is_pegin, self.assetIssuance) |
| 488 | |
| 489 | class CTxOutAsset: |
| 490 | __slots__ = ("vchCommitment") |
| 491 | |
| 492 | def __init__(self, vchCommitment=b"\x00"): |
| 493 | self.vchCommitment = vchCommitment |
| 494 | |
| 495 | def setNull(self): |
| 496 | self.vchCommitment = b'\x00' |
| 497 | |
| 498 | def deserialize(self, f): |
| 499 | version = ord(f.read(1)) |
| 500 | if version == 0: |
| 501 | self.vchCommitment = b'\x00' |
| 502 | elif version == 1: |
| 503 | self.vchCommitment = b'\x01' + f.read(32) |
| 504 | elif version == 0xff: |
| 505 | self.vchCommitment = b'\xff' + f.read(32) |
| 506 | elif version == 10 or version == 11: |
| 507 | self.vchCommitment = bytes([version]) + f.read(32) |
| 508 | else: |
| 509 | raise 'invalid CTxOutAsset in deserialize' |
| 510 | |
| 511 | def serialize(self): |
| 512 | r = b"" |
| 513 | r += self.vchCommitment |
| 514 | return r |
| 515 | |
| 516 | def setToAsset(self, val): |
| 517 | if len(val) != 32: |
| 518 | raise 'invalid asset hash (expected 32 bytes)' |
| 519 | self.vchCommitment = b'\x01' + val |
| 520 | |
| 521 | def __repr__(self): |
| 522 | return "CTxOutAsset(vchCommitment=%s)" % self.vchCommitment |
| 523 | |
| 524 | class CTxOutValue: |
| 525 | __slots__ = ("vchCommitment") |
no outgoing calls
no test coverage detected