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

Method decode

test/functional/test_framework/script.py:496–509  ·  view source on GitHub ↗
(vch)

Source from the content-addressed store, hash-verified

494
495 @staticmethod
496 def decode(vch):
497 result = 0
498 # We assume valid push_size and minimal encoding
499 value = vch[1:]
500 if len(value) == 0:
501 return result
502 for i, byte in enumerate(value):
503 result |= int(byte) << 8 * i
504 if value[-1] >= 0x80:
505 # Mask for all but the highest result bit
506 num_mask = (2**(len(value) * 8) - 1) >> 1
507 result &= num_mask
508 result *= -1
509 return result
510
511class CScript(bytes):
512 """Serialized script

Callers 15

download_binaryFunction · 0.45
check_hostFunction · 0.45
check_all_filenamesFunction · 0.45
check_source_filenamesFunction · 0.45
run_testMethod · 0.45
test_rest_requestMethod · 0.45
run_testMethod · 0.45

Calls 1

enumerateFunction · 0.50

Tested by 9

test_rest_requestMethod · 0.36
test_oversized_msgMethod · 0.36
get_nextMethod · 0.36
test_create_coinbaseMethod · 0.36
stop_nodeMethod · 0.36
_stop_perfMethod · 0.36