lnworker: fix get_onchain_history if running with --offline
```
Traceback (most recent call last):
File "...\electrum\electrum\gui\qt\main_window.py", line 898, in timer_actions
self.update_wallet()
File "...\electrum\electrum\gui\qt\main_window.py", line 1040, in update_wallet
self.update_tabs()
File "...\electrum\electrum\gui\qt\main_window.py", line 1047, in update_tabs
self.history_model.refresh('update_tabs')
File "...\electrum\electrum\util.py", line 439, in <lambda>
return lambda *args, **kw_args: do_profile(args, kw_args)
File "...\electrum\electrum\util.py", line 435, in do_profile
o = func(*args, **kw_args)
File "...\electrum\electrum\gui\qt\history_list.py", line 275, in refresh
transactions = wallet.get_full_history(
File "...\electrum\electrum\util.py", line 439, in <lambda>
return lambda *args, **kw_args: do_profile(args, kw_args)
File "...\electrum\electrum\util.py", line 435, in do_profile
o = func(*args, **kw_args)
File "...\electrum\electrum\wallet.py", line 947, in get_full_history
lnworker_history = self.lnworker.get_onchain_history() if self.lnworker and include_lightning else {}
File "...\electrum\electrum\lnworker.py", line 911, in get_onchain_history
tx_height = self.lnwatcher.get_tx_height(swap.funding_txid)
AttributeError: 'NoneType' object has no attribute 'get_tx_height'
```
This commit is contained in:
@@ -908,9 +908,10 @@ class LNWallet(LNWorker):
|
||||
amount_msat = 0
|
||||
label = 'Reverse swap' if swap.is_reverse else 'Forward swap'
|
||||
delta = current_height - swap.locktime
|
||||
tx_height = self.lnwatcher.get_tx_height(swap.funding_txid)
|
||||
if swap.is_reverse and tx_height.height <=0:
|
||||
label += ' (%s)' % _('waiting for funding tx confirmation')
|
||||
if self.lnwatcher:
|
||||
tx_height = self.lnwatcher.get_tx_height(swap.funding_txid)
|
||||
if swap.is_reverse and tx_height.height <= 0:
|
||||
label += ' (%s)' % _('waiting for funding tx confirmation')
|
||||
if not swap.is_reverse and not swap.is_redeemed and swap.spending_txid is None and delta < 0:
|
||||
label += f' (refundable in {-delta} blocks)' # fixme: only if unspent
|
||||
out[txid] = {
|
||||
|
||||
Reference in New Issue
Block a user