Browse Source

fix more type errors caused by jsonrpc (parsing floats and transactions)

283
ThomasV 9 years ago
parent
commit
026f9312a7
  1. 14
      lib/commands.py
  2. 1
      lib/transaction.py

14
lib/commands.py

@ -665,13 +665,15 @@ command_options = {
# don't use floats because of rounding errors # don't use floats because of rounding errors
json_loads = lambda x: json.loads(x, parse_float=lambda x: str(Decimal(x)))
arg_types = { arg_types = {
'num':int, 'num': int,
'nbits':int, 'nbits': int,
'entropy':long, 'entropy': long,
'pubkeys': json.loads, 'tx': json_loads,
'inputs': json.loads, 'pubkeys': json_loads,
'outputs': json.loads, 'inputs': json_loads,
'outputs': json_loads,
'tx_fee': lambda x: str(Decimal(x)) if x is not None else None, 'tx_fee': lambda x: str(Decimal(x)) if x is not None else None,
'amount': lambda x: str(Decimal(x)) if x!='!' else '!', 'amount': lambda x: str(Decimal(x)) if x!='!' else '!',
} }

1
lib/transaction.py

@ -761,7 +761,6 @@ class Transaction:
return out return out
def sign(self, keypairs): def sign(self, keypairs):
print "sign"
for i, txin in enumerate(self.inputs): for i, txin in enumerate(self.inputs):
num = txin['num_sig'] num = txin['num_sig']
for x_pubkey in txin['x_pubkeys']: for x_pubkey in txin['x_pubkeys']:

Loading…
Cancel
Save