MCPcopy Create free account
hub / github.com/Raptor3um/raptoreum / encode

Method encode

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

Source from the content-addressed store, hash-verified

370
371 @staticmethod
372 def encode(obj):
373 r = bytearray(0)
374 if obj.value == 0:
375 return bytes(r)
376 neg = obj.value < 0
377 absvalue = -obj.value if neg else obj.value
378 while (absvalue):
379 r.append(absvalue & 0xff)
380 absvalue >>= 8
381 if r[-1] & 0x80:
382 r.append(0x80 if neg else 0)
383 elif neg:
384 r[-1] |= 0x80
385 return bytes([len(r)]) + r
386
387
388class CScript(bytes):

Callers 15

hex_switchEndianFunction · 0.80
__init__Method · 0.80
hex_switchEndianFunction · 0.80
linearize-data.pyFile · 0.80
base58.pyFile · 0.80
tree_sha512sumFunction · 0.80
mainFunction · 0.80
prepare_objectMethod · 0.80
test_runner.pyFile · 0.80
__init__Method · 0.80
__call__Method · 0.80

Calls 2

bytesFunction · 0.85
appendMethod · 0.80

Tested by 1