commit 026f9312a7189cd8ef903ac24b68a60906e51706
parent f8f124ad8463ee1f047325e740b4dba258f0888f
Author: ThomasV <thomasv@electrum.org>
Date: Wed, 16 Dec 2015 20:17:20 +0100
fix more type errors caused by jsonrpc (parsing floats and transactions)
Diffstat:
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/lib/commands.py b/lib/commands.py
@@ -665,13 +665,15 @@ command_options = {
# don't use floats because of rounding errors
+json_loads = lambda x: json.loads(x, parse_float=lambda x: str(Decimal(x)))
arg_types = {
- 'num':int,
- 'nbits':int,
- 'entropy':long,
- 'pubkeys': json.loads,
- 'inputs': json.loads,
- 'outputs': json.loads,
+ 'num': int,
+ 'nbits': int,
+ 'entropy': long,
+ 'tx': json_loads,
+ 'pubkeys': json_loads,
+ 'inputs': json_loads,
+ 'outputs': json_loads,
'tx_fee': lambda x: str(Decimal(x)) if x is not None else None,
'amount': lambda x: str(Decimal(x)) if x!='!' else '!',
}
diff --git a/lib/transaction.py b/lib/transaction.py
@@ -761,7 +761,6 @@ class Transaction:
return out
def sign(self, keypairs):
- print "sign"
for i, txin in enumerate(self.inputs):
num = txin['num_sig']
for x_pubkey in txin['x_pubkeys']: