commit a53dded50fad595dce34be609c59fddad61d66be
parent d7c5949365cf061020e5dfb82ca26171c0692eb6
Author: SomberNight <somber.night@protonmail.com>
Date: Mon, 26 Nov 2018 01:34:23 +0100
bitcoin: avoid floating point in int_to_hex
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/electrum/bitcoin.py b/electrum/bitcoin.py
@@ -60,7 +60,7 @@ def int_to_hex(i: int, length: int=1) -> str:
if not isinstance(i, int):
raise TypeError('{} instead of int'.format(i))
range_size = pow(256, length)
- if i < -range_size/2 or i >= range_size:
+ if i < -(range_size//2) or i >= range_size:
raise OverflowError('cannot convert int {} to hex ({} bytes)'.format(i, length))
if i < 0:
# two's complement