Browse Source

wallet.get_tx_parents: fix: tx should not be its own uncle

```
  3.06 | I | w/wallet.Standard_Wallet.[default_wallet] | get_tx_parents() cp0. entered for txid='407d03126255cce62a1101075db906587bd492f512166119d3f87b8a1b013497'
  3.06 | I | w/wallet.Standard_Wallet.[default_wallet] | get_tx_parents() cp4.1. parents=['e2d915520f6d42273158a6fd08b38d812bd554aa906d3ed45d103757d45af2bb']
  3.06 | I | w/wallet.Standard_Wallet.[default_wallet] | get_tx_parents() cp4.2. uncles=[]
  3.06 | I | w/wallet.Standard_Wallet.[default_wallet] | get_tx_parents() cp2. populating cache... _txid='434808dab0c93715bb8b7ce85f73bffd0bdf7c1ba205fe0f704226646971e555'
  3.06 | I | w/wallet.Standard_Wallet.[default_wallet] | get_tx_parents() cp0. entered for txid='434808dab0c93715bb8b7ce85f73bffd0bdf7c1ba205fe0f704226646971e555'
  3.06 | I | w/wallet.Standard_Wallet.[default_wallet] | get_tx_parents() cp3.0. uncle_txid='434808dab0c93715bb8b7ce85f73bffd0bdf7c1ba205fe0f704226646971e555'
  3.06 | I | w/wallet.Standard_Wallet.[default_wallet] | get_tx_parents() cp3.1. reuse_height=-2 reuse_pos=-1
  3.06 | I | w/wallet.Standard_Wallet.[default_wallet] | get_tx_parents() cp3.2. my_height=1338 my_pos=1
  3.06 | I | w/wallet.Standard_Wallet.[default_wallet] | get_tx_parents() cp4.1. parents=['407d03126255cce62a1101075db906587bd492f512166119d3f87b8a1b013497']
  3.06 | I | w/wallet.Standard_Wallet.[default_wallet] | get_tx_parents() cp4.2. uncles=['434808dab0c93715bb8b7ce85f73bffd0bdf7c1ba205fe0f704226646971e555']
 40.82 | E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/gui/qt/main_window.py", line 846, in timer_actions
    self.update_wallet()
  File "/home/user/wspace/electrum/electrum/gui/qt/main_window.py", line 1001, in update_wallet
    self.update_tabs()
  File "/home/user/wspace/electrum/electrum/gui/qt/main_window.py", line 1013, in update_tabs
    self.utxo_list.update()
  File "/home/user/wspace/electrum/electrum/util.py", line 470, in <lambda>
    return lambda *args, **kw_args: do_profile(args, kw_args)
  File "/home/user/wspace/electrum/electrum/util.py", line 465, in do_profile
    o = func(*args, **kw_args)
  File "/home/user/wspace/electrum/electrum/gui/qt/utxo_list.py", line 115, in update
    self.refresh_row(name, idx)
  File "/home/user/wspace/electrum/electrum/gui/qt/utxo_list.py", line 137, in refresh_row
    num_parents = self.wallet.get_num_parents(txid)
  File "/home/user/wspace/electrum/electrum/wallet.py", line 897, in get_num_parents
    self._num_parents[txid] = len(self.get_tx_parents(txid))
  File "/home/user/wspace/electrum/electrum/wallet.py", line 910, in get_tx_parents
    self.get_tx_parents(_txid)
  File "/home/user/wspace/electrum/electrum/wallet.py", line 938, in get_tx_parents
    p = self._tx_parents_cache[_txid]
KeyError: '434808dab0c93715bb8b7ce85f73bffd0bdf7c1ba205fe0f704226646971e555'
```
master
SomberNight 3 years ago
parent
commit
a1bfea6121
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 2
      electrum/wallet.py

2
electrum/wallet.py

@ -929,6 +929,8 @@ class Abstract_Wallet(ABC, Logger, EventListener):
for k, v in sent.items():
if k != txin.prevout.to_str():
reuse_txid, reuse_height, reuse_pos = v
if reuse_height <= 0: # exclude not-yet-mined (we need topological ordering)
continue
if (reuse_height, reuse_pos) < (my_height, my_pos):
uncle_txid, uncle_index = k.split(':')
uncles.append(uncle_txid)

Loading…
Cancel
Save