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

Class CTxOutWitness

test/functional/test_framework/messages.py:730–759  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

728
729
730class CTxOutWitness:
731 __slots__ = ("vchSurjectionproof", "vchRangeproof")
732
733 def __init__(self):
734 self.vchSurjectionproof = b''
735 self.vchRangeproof = b''
736
737 def deserialize(self, f):
738 self.vchSurjectionproof = deser_string(f)
739 self.vchRangeproof = deser_string(f)
740
741 def serialize(self):
742 r = b''
743 r += ser_string(self.vchSurjectionproof)
744 r += ser_string(self.vchRangeproof)
745 return r
746
747 def calc_witness_hash(self):
748 leaves = [
749 hash256(ser_string(self.vchSurjectionproof))[::-1].hex(),
750 hash256(ser_string(self.vchRangeproof))[::-1].hex()
751 ]
752 return calcfastmerkleroot(leaves)
753
754 def __repr__(self):
755 return "CTxOutWitness (%s, %s)" % (self.vchSurjectionproof, self.vchRangeproof)
756
757 def is_null(self):
758 return len(self.vchSurjectionproof) == 0 \
759 and len(self.vchRangeproof) == 0
760
761
762class CTxWitness:

Callers 9

issuance_testMethod · 0.90
run_testMethod · 0.90
test_spendersMethod · 0.90
gen_test_vectorsMethod · 0.90
deserializeMethod · 0.70
calc_witness_hashMethod · 0.70

Calls

no outgoing calls

Tested by 2

test_spendersMethod · 0.72