Browse Source

fix #8391: reintroduce recursion, limited to unconfirmed transactions

It would be better to have topological order, but this issue needs to
be fixed quickly.
master
ThomasV 3 years ago
parent
commit
c0917e65af
  1. 11
      electrum/wallet.py

11
electrum/wallet.py

@ -907,9 +907,11 @@ class Abstract_Wallet(ABC, Logger, EventListener):
with self.lock, self.transaction_lock: with self.lock, self.transaction_lock:
if self._last_full_history is None: if self._last_full_history is None:
self._last_full_history = self.get_full_history(None, include_lightning=False) self._last_full_history = self.get_full_history(None, include_lightning=False)
# populate cache in chronological order # populate cache in chronological order (confirmed tx only)
for _txid in self._last_full_history.keys(): # todo: get_full_history should return unconfirmed tx topologically sorted
self.get_tx_parents(_txid) for _txid, tx_item in self._last_full_history.items():
if tx_item['height'] > 0:
self.get_tx_parents(_txid)
result = self._tx_parents_cache.get(txid, None) result = self._tx_parents_cache.get(txid, None)
if result is not None: if result is not None:
@ -941,8 +943,7 @@ class Abstract_Wallet(ABC, Logger, EventListener):
for _txid in parents + uncles: for _txid in parents + uncles:
if _txid in self._last_full_history.keys(): if _txid in self._last_full_history.keys():
p = self._tx_parents_cache[_txid] result.update(self.get_tx_parents(_txid))
result.update(p)
result[txid] = parents, uncles result[txid] = parents, uncles
self._tx_parents_cache[txid] = result self._tx_parents_cache[txid] = result
return result return result

Loading…
Cancel
Save