MCPcopy Create free account
hub / github.com/Bitcoin-ABC/bitcoin-abc / decode

Method decode

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

Source from the content-addressed store, hash-verified

416
417 @staticmethod
418 def decode(vch):
419 result = 0
420 # We assume valid push_size and minimal encoding
421 value = vch[1:]
422 if len(value) == 0:
423 return result
424 for i, byte in enumerate(value):
425 result |= int(byte) << 8 * i
426 if value[-1] >= 0x80:
427 # Mask for all but the highest result bit
428 num_mask = (2 ** (len(value) * 8) - 1) >> 1
429 result &= num_mask
430 result *= -1
431 return result
432
433
434class CScript(bytes):

Callers 15

get_git_file_metadataFunction · 0.45
mainFunction · 0.45
test_rest_requestMethod · 0.45
run_testMethod · 0.45
test_oversized_msgMethod · 0.45
c_string_to_strFunction · 0.45
mini_parserFunction · 0.45
__repr__Method · 0.45

Calls

no outgoing calls

Tested by 11

test_rest_requestMethod · 0.36
test_oversized_msgMethod · 0.36
runMethod · 0.36
test_create_coinbaseMethod · 0.36
is_node_stoppedMethod · 0.36
wait_for_debug_logMethod · 0.36
_stop_perfMethod · 0.36