1
0

fix #4099: serialisation of txns with negative version number

This commit is contained in:
SomberNight
2018-03-13 01:02:03 +01:00
parent 87aee10047
commit a6841cbd5f
2 changed files with 8 additions and 0 deletions

View File

@@ -144,6 +144,9 @@ def rev_hex(s):
def int_to_hex(i, length=1):
assert isinstance(i, int)
if i < 0:
# two's complement
i = pow(256, length) + i
s = hex(i)[2:].rstrip('L')
s = "0"*(2*length - len(s)) + s
return rev_hex(s)