MCPcopy Create free account
hub / github.com/LUX-Core/lux / encode

Method encode

test/functional/test_framework/script.py:637–650  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

635
636 @staticmethod
637 def encode(obj):
638 r = bytearray(0)
639 if obj.value == 0:
640 return bytes(r)
641 neg = obj.value < 0
642 absvalue = -obj.value if neg else obj.value
643 while (absvalue):
644 r.append(absvalue & 0xff)
645 absvalue >>= 8
646 if r[-1] & 0x80:
647 r.append(0x80 if neg else 0)
648 elif neg:
649 r[-1] |= 0x80
650 return bytes(bchr(len(r)) + r)
651
652
653class CScript(bytes):

Callers 9

test_runner.pyFile · 0.45
__init__Method · 0.45
__call__Method · 0.45
_batchMethod · 0.45
__coerce_instanceMethod · 0.45
byte_to_base58Function · 0.45
base58_to_byteFunction · 0.45
hex_str_to_bytesFunction · 0.45
str_to_b64strFunction · 0.45

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected