From acec9c2b4313a65dca42ce106cfe442680a09201 Mon Sep 17 00:00:00 2001 From: shunyata Date: Fri, 29 Nov 2013 15:27:59 -0500 Subject: [PATCH] Parse amounts from CSV with Decimal and not float. This fixes a bug where amounts are read from a CSV file incorrectly due to floating point representation error. For example, the string 0.009 will be parsed as 0.00899999, and then converted to 899999, resulting in one fewer satoshi being sent as part of the transaction generated from the CSV file. --- gui/qt/main_window.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py index a3dd082c..10ffde2d 100644 --- a/gui/qt/main_window.py +++ b/gui/qt/main_window.py @@ -1882,7 +1882,7 @@ class ElectrumWindow(QMainWindow): try: for row in csvReader: address = row[0] - amount = float(row[1]) + amount = Decimal(row[1]) amount = int(100000000*amount) outputs.append((address, amount)) except (ValueError, IOError, os.error), reason: