Browse Source

Merge pull request #6476 from brianddk/deserialize_serialize

Correct errors in command 'serialize(deserialize(pbst))'
patch-4
ThomasV 4 years ago
committed by GitHub
parent
commit
47027b6646
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      electrum/commands.py

6
electrum/commands.py

@ -360,7 +360,7 @@ class Commands:
"""
keypairs = {}
inputs = [] # type: List[PartialTxInput]
locktime = jsontx.get('lockTime', 0)
locktime = jsontx.get('locktime', 0)
for txin_dict in jsontx.get('inputs'):
if txin_dict.get('prevout_hash') is not None and txin_dict.get('prevout_n') is not None:
prevout = TxOutpoint(txid=bfh(txin_dict['prevout_hash']), out_idx=int(txin_dict['prevout_n']))
@ -369,7 +369,7 @@ class Commands:
else:
raise Exception("missing prevout for txin")
txin = PartialTxInput(prevout=prevout)
txin._trusted_value_sats = int(txin_dict['value'])
txin._trusted_value_sats = int(txin_dict.get('value', txin_dict['value_sats']))
nsequence = txin_dict.get('nsequence', None)
if nsequence is not None:
txin.nsequence = nsequence
@ -383,7 +383,7 @@ class Commands:
txin.num_sig = 1
inputs.append(txin)
outputs = [PartialTxOutput.from_address_and_value(txout['address'], int(txout['value']))
outputs = [PartialTxOutput.from_address_and_value(txout['address'], int(txout.get('value', txout['value_sats'])))
for txout in jsontx.get('outputs')]
tx = PartialTransaction.from_io(inputs, outputs, locktime=locktime)
tx.sign(keypairs)

Loading…
Cancel
Save