tbitcoin: avoid floating point in int_to_hex - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit a53dded50fad595dce34be609c59fddad61d66be DIR parent d7c5949365cf061020e5dfb82ca26171c0692eb6 HTML Author: SomberNight <somber.night@protonmail.com> Date: Mon, 26 Nov 2018 01:34:23 +0100 bitcoin: avoid floating point in int_to_hex Diffstat: M electrum/bitcoin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- DIR diff --git a/electrum/bitcoin.py b/electrum/bitcoin.py t@@ -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