From faa002f53ce37a2941e82800bd518c56cc57637b Mon Sep 17 00:00:00 2001 From: ThomasV Date: Fri, 26 Oct 2012 22:51:33 +0200 Subject: [PATCH] fix: below or equal in var_int encoding --- lib/bitcoin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bitcoin.py b/lib/bitcoin.py index a2a79936b..c8e8ba04e 100644 --- a/lib/bitcoin.py +++ b/lib/bitcoin.py @@ -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)