Skip to content

Commit

Permalink
handle missing witness_utxo
Browse files Browse the repository at this point in the history
  • Loading branch information
stepansnigirev committed Jan 20, 2021
1 parent b6ef806 commit 9250a1e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/apps/wallets/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ async def sign_psbt(self, stream, show_screen, encoding=BASE64_STREAM):
else:
data = stream.read()
psbt = PSBT.parse(data)
# check if all witness_utxos are there and fill if not
for i, inp in enumerate(psbt.inputs):
if inp.witness_utxo is None:
if inp.non_witness_utxo is None:
raise WalletError("Invalid PSBT - missing previous transaction")
inp.witness_utxo = inp.non_witness_utxo.vout[psbt.tx.vin[i].vout]

wallets, meta = self.parse_psbt(psbt=psbt)
# there is an unknown wallet
# wallet is a list of tuples: (wallet, amount)
Expand Down

0 comments on commit 9250a1e

Please sign in to comment.