commit 47027b66462406d9d992236288ae5099ca338e7b
parent d5c360a958f3666ad137443f812e7923c039ab52
Author: ThomasV <thomasv@electrum.org>
Date: Mon, 11 Jan 2021 13:15:14 +0100
Merge pull request #6476 from brianddk/deserialize_serialize
Correct errors in command 'serialize(deserialize(pbst))'
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/electrum/commands.py b/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)