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

Method encode

qa/rpc-tests/test_framework/script.py:631–644  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

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

Callers 11

calc_hash_strFunction · 0.45
base58.pyFile · 0.45
tree_sha512sumFunction · 0.45
mainFunction · 0.45
__init__Method · 0.45
__call__Method · 0.45
_batchMethod · 0.45
__coerce_instanceMethod · 0.45
hex_str_to_bytesFunction · 0.45
str_to_b64strFunction · 0.45
__init__Method · 0.45

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected