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

Class CTxOutNonce

test/functional/test_framework/messages.py:581–609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579 return "CTxOutValue(vchCommitment=%s)" % self.vchCommitment
580
581class CTxOutNonce:
582 __slots__ = ("vchCommitment")
583
584 def __init__(self, vchCommitment=b"\x00"):
585 self.vchCommitment = vchCommitment
586
587 def setNull(self):
588 self.vchCommitment = b'\x00'
589
590 def deserialize(self, f):
591 version = ord(f.read(1))
592 if version == 0:
593 self.vchCommitment = b'\x00'
594 elif version == 1:
595 self.vchCommitment = b'\x01' + f.read(32)
596 elif version == 0xff:
597 self.vchCommitment = b'\xff' + f.read(32)
598 elif version == 2 or version == 3:
599 self.vchCommitment = bytes([version]) + f.read(32)
600 else:
601 raise ValueError('invalid CTxOutNonce in deserialize')
602
603 def serialize(self):
604 r = b""
605 r += self.vchCommitment
606 return r
607
608 def __repr__(self):
609 return "CTxOutNonce(vchCommitment=%s)" % self.vchCommitment
610
611
612class CTxOut():

Callers 4

run_testMethod · 0.90
__init__Method · 0.85
deserializeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected