From 5e589133c9a9caa3e7e0219a8dd4d9acc2fb53ff Mon Sep 17 00:00:00 2001 From: Dan Haiduc Date: Fri, 20 Oct 2017 21:35:18 +0300 Subject: [PATCH] Update commands: output str(Decimals), not floats The commands `listunspent` and `history` were using float. Patched to consistently return strings of Decimal objects. --- lib/commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/commands.py b/lib/commands.py index fd5aa3e0..d01c6810 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -193,7 +193,7 @@ class Commands: l = copy.deepcopy(self.wallet.get_utxos(exclude_frozen=False)) for i in l: v = i["value"] - i["value"] = float(v)/COIN if v is not None else None + i["value"] = str(Decimal(v)/COIN) if v is not None else None return l @command('n') @@ -486,7 +486,7 @@ class Commands: 'input_addresses': input_addresses, 'output_addresses': output_addresses, 'label': label, - 'value': float(value)/COIN if value is not None else None, + 'value': str(Decimal(value)/COIN) if value is not None else None, 'height': height, 'confirmations': conf })