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

Method encode

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

Source from the content-addressed store, hash-verified

394
395 @staticmethod
396 def encode(obj):
397 r = bytearray(0)
398 if obj.value == 0:
399 return bytes(r)
400 neg = obj.value < 0
401 absvalue = -obj.value if neg else obj.value
402 while (absvalue):
403 r.append(absvalue & 0xff)
404 absvalue >>= 8
405 if r[-1] & 0x80:
406 r.append(0x80 if neg else 0)
407 elif neg:
408 r[-1] |= 0x80
409 return bytes([len(r)]) + r
410
411 @staticmethod
412 def decode(vch):

Callers 15

run_testMethod · 0.45
send_json_rpcFunction · 0.45
run_testMethod · 0.45
__init__Method · 0.45
test_argsMethod · 0.45
post_rawMethod · 0.45
check_idle_timeoutMethod · 0.45

Calls

no outgoing calls

Tested by 5

test_argsMethod · 0.36