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

Method encode

qa/rpc-tests/test_framework/script.py:681–694  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

679
680 @staticmethod
681 def encode(obj):
682 r = bytearray(0)
683 if obj.value == 0:
684 return bytes(r)
685 neg = obj.value < 0
686 absvalue = -obj.value if neg else obj.value
687 while (absvalue):
688 r.append(absvalue & 0xff)
689 absvalue >>= 8
690 if r[-1] & 0x80:
691 r.append(0x80 if neg else 0)
692 elif neg:
693 r[-1] |= 0x80
694 return bytes(bchr(len(r)) + r)
695
696
697class CScript(bytes):

Callers 15

calc_hash_strFunction · 0.80
runMethod · 0.80
base58.pyFile · 0.80
run_testMethod · 0.80
testDatasigRpcMethod · 0.80
run_testMethod · 0.80
Hash256PuzzleFunction · 0.80
MatchStringFunction · 0.80
run_testMethod · 0.80
run_testMethod · 0.80

Calls 1

appendMethod · 0.80

Tested by 2

mainFunction · 0.64
mainFunction · 0.64