Browse Source

qt tx dialog: fix for pre-segwit legacy wallets

```
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/gui/qt/invoice_list.py", line 169, in <lambda>
    menu.addAction(_("Pay") + "...", lambda: self.send_tab.do_pay_invoice(invoice))
  File "/home/user/wspace/electrum/electrum/gui/qt/send_tab.py", line 585, in do_pay_invoice
    self.pay_onchain_dialog(self.window.get_coins(), invoice.outputs)
  File "/home/user/wspace/electrum/electrum/gui/qt/send_tab.py", line 271, in pay_onchain_dialog
    preview_dlg = PreviewTxDialog(
  File "/home/user/wspace/electrum/electrum/gui/qt/transaction_dialog.py", line 962, in __init__
    self.update()
  File "/home/user/wspace/electrum/electrum/gui/qt/transaction_dialog.py", line 658, in update
    self.io_widget.update(self.tx)
  File "/home/user/wspace/electrum/electrum/gui/qt/transaction_dialog.py", line 212, in update
    tx_height, tx_pos = self.wallet.adb.get_txpos(self.tx.txid())
  File "/home/user/wspace/electrum/electrum/address_synchronizer.py", line 483, in get_txpos
    verified_tx_mined_info = self.db.get_verified_tx(tx_hash)
  File "/home/user/wspace/electrum/electrum/json_db.py", line 44, in wrapper
    return func(self, *args, **kwargs)
  File "/home/user/wspace/electrum/electrum/wallet_db.py", line 1256, in get_verified_tx
    assert isinstance(txid, str)
AssertionError
```
master
SomberNight 3 years ago
parent
commit
b4d2c902c4
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 12
      electrum/gui/qt/transaction_dialog.py

12
electrum/gui/qt/transaction_dialog.py

@ -226,14 +226,18 @@ class TxInOutWidget(QWidget):
o_text.clear()
o_text.setFont(QFont(MONOSPACE_FONT))
o_text.setReadOnly(True)
tx_height, tx_pos = self.wallet.adb.get_txpos(self.tx.txid())
tx_hash = bytes.fromhex(self.tx.txid())
tx_height, tx_pos = None, None
tx_hash = self.tx.txid()
if tx_hash:
tx_height, tx_pos = self.wallet.adb.get_txpos(tx_hash)
cursor = o_text.textCursor()
for txout_idx, o in enumerate(self.tx.outputs()):
if tx_pos is not None and tx_pos >= 0:
if tx_height is not None and tx_pos is not None and tx_pos >= 0:
short_id = ShortID.from_components(tx_height, tx_pos, txout_idx)
elif tx_hash:
short_id = TxOutpoint(bytes.fromhex(tx_hash), txout_idx).short_name()
else:
short_id = TxOutpoint(tx_hash, txout_idx).short_name()
short_id = f"unknown:{txout_idx}"
addr = o.get_ui_address_str()
insert_tx_io(
cursor=cursor, is_coinbase=False, txio_idx=txout_idx,

Loading…
Cancel
Save