MCPcopy Create free account
hub / github.com/ElementsProject/elements / CTxOutAsset

Class CTxOutAsset

test/functional/test_framework/messages.py:489–522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

487 self.nSequence, self.m_is_pegin, self.assetIssuance)
488
489class 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
524class CTxOutValue:
525 __slots__ = ("vchCommitment")

Callers 5

run_testMethod · 0.90
LegacySignatureMsgFunction · 0.85
__init__Method · 0.85
deserializeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected