diff --git a/electrum/lnchannel.py b/electrum/lnchannel.py index df34e8c8b..683f44a62 100644 --- a/electrum/lnchannel.py +++ b/electrum/lnchannel.py @@ -327,7 +327,7 @@ class AbstractChannel(Logger, ABC): is_local_ctx = who_closed == LOCAL return is_local_ctx, sweep_info - def maybe_sweep_htlcs(self, ctx: Transaction, htlc_tx: Transaction) -> Dict[str, SweepInfo]: + def maybe_sweep_htlcs(self, ctx: Transaction, htlc_tx: Transaction) -> Dict[str, MaybeSweepInfo]: return {} def extract_preimage_from_htlc_txin(self, txin: TxInput, *, is_deeply_mined: bool) -> None: @@ -682,7 +682,7 @@ class ChannelBackup(AbstractChannel): else: return {} - def maybe_sweep_htlcs(self, ctx: Transaction, htlc_tx: Transaction) -> Dict[str, SweepInfo]: + def maybe_sweep_htlcs(self, ctx: Transaction, htlc_tx: Transaction) -> Dict[str, MaybeSweepInfo]: return {} def extract_preimage_from_htlc_txin(self, txin: TxInput, *, is_deeply_mined: bool) -> None: @@ -1939,7 +1939,7 @@ class Channel(AbstractChannel): assert not (self.get_state() == ChannelState.WE_ARE_TOXIC and ChanCloseOption.LOCAL_FCLOSE in ret), "local force-close unsafe if we are toxic" return ret - def maybe_sweep_htlcs(self, ctx: Transaction, htlc_tx: Transaction) -> Dict[str, SweepInfo]: + def maybe_sweep_htlcs(self, ctx: Transaction, htlc_tx: Transaction) -> Dict[str, MaybeSweepInfo]: # look at the output address, check if it matches d = sweep_their_htlctx_justice(self, ctx, htlc_tx) d2 = sweep_our_htlctx(self, ctx, htlc_tx) diff --git a/electrum/lnwatcher.py b/electrum/lnwatcher.py index 354b0a6a0..4db9b04e8 100644 --- a/electrum/lnwatcher.py +++ b/electrum/lnwatcher.py @@ -184,9 +184,13 @@ class LNWatcher(Logger, EventListener): # the spender might be the remote, revoked or not htlc_sweepinfo = chan.maybe_sweep_htlcs(closing_tx, spender_tx) for prevout2, htlc_sweep_info in htlc_sweepinfo.items(): + self.lnworker.wallet.set_default_label(prevout2, htlc_sweep_info.name) + if isinstance(htlc_sweep_info, KeepWatchingTXO): # haven't yet decided if we want to sweep + keep_watching |= htlc_sweep_info.until_height > local_height + continue + assert isinstance(htlc_sweep_info, SweepInfo), htlc_sweep_info watch_htlc_sweep_info = self.maybe_redeem(htlc_sweep_info) htlc_tx_spender = self.adb.get_spender(prevout2) - self.lnworker.wallet.set_default_label(prevout2, htlc_sweep_info.name) if htlc_tx_spender: keep_watching |= not self.adb.is_deeply_mined(htlc_tx_spender) self.maybe_add_accounting_address(htlc_tx_spender, htlc_sweep_info)