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

Method encode

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

Source from the content-addressed store, hash-verified

400
401 @staticmethod
402 def encode(obj):
403 r = bytearray(0)
404 if obj.value == 0:
405 return bytes(r)
406 neg = obj.value < 0
407 absvalue = -obj.value if neg else obj.value
408 while absvalue:
409 r.append(absvalue & 0xFF)
410 absvalue >>= 8
411 if r[-1] & 0x80:
412 r.append(0x80 if neg else 0)
413 elif neg:
414 r[-1] |= 0x80
415 return bytes([len(r)]) + r
416
417 @staticmethod
418 def decode(vch):

Callers 15

finalize_contendersMethod · 0.45
run_testMethod · 0.45
get_coinbase_scriptsigFunction · 0.45
run_testMethod · 0.45
__init__Method · 0.45
run_testMethod · 0.45
run_for_ratioMethod · 0.45
stale_txidMethod · 0.45
test_block_fullMethod · 0.45
run_testMethod · 0.45
run_testMethod · 0.45

Calls

no outgoing calls

Tested by 2

test_block_fullMethod · 0.36