MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / encode

Method encode

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

Source from the content-addressed store, hash-verified

368
369 @staticmethod
370 def encode(obj):
371 r = bytearray(0)
372 if obj.value == 0:
373 return bytes(r)
374 neg = obj.value < 0
375 absvalue = -obj.value if neg else obj.value
376 while (absvalue):
377 r.append(absvalue & 0xff)
378 absvalue >>= 8
379 if r[-1] & 0x80:
380 r.append(0x80 if neg else 0)
381 elif neg:
382 r[-1] |= 0x80
383 return bytes([len(r)]) + r
384
385
386class 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
tree_sha512sumFunction · 0.80
mainFunction · 0.80
run_testMethod · 0.80
sign_p2pk_witness_inputFunction · 0.80
test_runner.pyFile · 0.80

Calls

no outgoing calls

Tested by 1