From c63c727df03bfcae3d46c2f9ed27275f20abbf9a Mon Sep 17 00:00:00 2001 From: mcudev <29890609+mcudev@users.noreply.github.com> Date: Sun, 13 Sep 2020 01:43:19 -0400 Subject: [PATCH] [python] build_tx tool: fix amount inaccuracy by parsing with Decimal --- python/tools/build_tx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/tools/build_tx.py b/python/tools/build_tx.py index 9d7d4aa454..e0b824c105 100755 --- a/python/tools/build_tx.py +++ b/python/tools/build_tx.py @@ -18,6 +18,7 @@ import json import click +import decimal import requests from trezorlib import btc, messages, tools @@ -72,7 +73,7 @@ def _get_inputs_interactive(blockbook_url): if not r.ok: raise click.ClickException(f"Failed to fetch URL: {tx_url}") - tx_json = r.json() + tx_json = r.json(parse_float=decimal.Decimal) if "error" in tx_json: raise click.ClickException(f"Transaction not found: {txhash}")