From 599ad1c0173427c008767f201daffd8b80d780b8 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Mon, 13 Jun 2022 10:26:07 +0200 Subject: [PATCH] lnworker: get_onchain_history does not need to be online anymore --- electrum/lnworker.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/electrum/lnworker.py b/electrum/lnworker.py index de58ce6d2..87b36964f 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -856,10 +856,8 @@ class LNWallet(LNWorker): item = chan.get_funding_height() if item is None: continue - if not self.lnwatcher: - continue # lnwatcher not available with --offline (its data is not persisted) funding_txid, funding_height, funding_timestamp = item - tx_height = self.lnwatcher.adb.get_tx_height(funding_txid) + tx_height = self.wallet.adb.get_tx_height(funding_txid) item = { 'channel_id': bh2u(chan.channel_id), 'type': 'channel_opening', @@ -879,7 +877,7 @@ class LNWallet(LNWorker): if item is None: continue closing_txid, closing_height, closing_timestamp = item - tx_height = self.lnwatcher.adb.get_tx_height(closing_txid) + tx_height = self.wallet.adb.get_tx_height(closing_txid) item = { 'channel_id': bh2u(chan.channel_id), 'txid': closing_txid, @@ -910,10 +908,9 @@ class LNWallet(LNWorker): amount_msat = 0 label = 'Reverse swap' if swap.is_reverse else 'Forward swap' delta = current_height - swap.locktime - if self.lnwatcher: - tx_height = self.lnwatcher.adb.get_tx_height(swap.funding_txid) - if swap.is_reverse and tx_height.height <= 0: - label += ' (%s)' % _('waiting for funding tx confirmation') + tx_height = self.wallet.adb.get_tx_height(swap.funding_txid) + if swap.is_reverse and tx_height.height <= 0: + label += ' (%s)' % _('funding transaction not confirmed') 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] = {