1
0

lnwatcher: follow-up prev

This commit is contained in:
SomberNight
2025-12-17 10:23:16 +00:00
parent 7e1fd008f0
commit f339a6b76d
2 changed files with 8 additions and 4 deletions

View File

@@ -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)

View File

@@ -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)