fix: below or equal in var_int encoding
authorThomasV <thomasv@gitorious>
Fri, 26 Oct 2012 20:51:33 +0000 (22:51 +0200)
committerThomasV <thomasv@gitorious>
Fri, 26 Oct 2012 20:51:33 +0000 (22:51 +0200)
lib/bitcoin.py

index a2a7993..c8e8ba0 100644 (file)
@@ -31,9 +31,9 @@ def int_to_hex(i, length=1):
 def var_int(i):
     if i<0xfd:
         return int_to_hex(i)
-    elif i<0xffff:
+    elif i<=0xffff:
         return "fd"+int_to_hex(i,2)
-    elif i<0xffffffff:
+    elif i<=0xffffffff:
         return "fe"+int_to_hex(i,4)
     else:
         return "ff"+int_to_hex(i,8)