MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / encodeVarint

Function encodeVarint

src/addresses.py:57–71  ·  view source on GitHub ↗
(integer)

Source from the content-addressed store, hash-verified

55 return num
56
57def encodeVarint(integer):
58 if integer < 0:
59 logger.error('varint cannot be < 0')
60 raise SystemExit
61 if integer < 253:
62 return pack('>B',integer)
63 if integer >= 253 and integer < 65536:
64 return pack('>B',253) + pack('>H',integer)
65 if integer >= 65536 and integer < 4294967296:
66 return pack('>B',254) + pack('>I',integer)
67 if integer >= 4294967296 and integer < 18446744073709551616:
68 return pack('>B',255) + pack('>Q',integer)
69 if integer >= 18446744073709551616:
70 logger.error('varint cannot be >= 18446744073709551616')
71 raise SystemExit
72
73class varintDecodeError(Exception):
74 pass

Callers 15

genAckPayloadFunction · 0.90
assembleVersionMessageFunction · 0.90
assembleErrorMessageFunction · 0.90
_onSuccessMethod · 0.90
processmsgMethod · 0.85
processbroadcastMethod · 0.85
possibleNewPubkeyMethod · 0.85
runMethod · 0.85
reloadMyAddressHashesFunction · 0.85
runMethod · 0.85
runMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected