diff --git a/electrum/lnchannel.py b/electrum/lnchannel.py index 456d6e610..6d1174494 100644 --- a/electrum/lnchannel.py +++ b/electrum/lnchannel.py @@ -1576,8 +1576,8 @@ class Channel(AbstractChannel): # to the present, then unilaterally close channel recv_htlc_deadline = lnutil.NBLOCK_DEADLINE_BEFORE_EXPIRY_FOR_RECEIVED_HTLCS for sub, dir, ctn in ((LOCAL, RECEIVED, self.get_latest_ctn(LOCAL)), - (REMOTE, SENT, self.get_oldest_unrevoked_ctn(LOCAL)), - (REMOTE, SENT, self.get_latest_ctn(LOCAL)),): + (REMOTE, SENT, self.get_oldest_unrevoked_ctn(REMOTE)), + (REMOTE, SENT, self.get_latest_ctn(REMOTE)),): for htlc_id, htlc in self.hm.htlcs_by_direction(subject=sub, direction=dir, ctn=ctn).items(): if not self.hm.was_htlc_preimage_released(htlc_id=htlc_id, htlc_proposer=REMOTE): continue @@ -1588,8 +1588,8 @@ class Channel(AbstractChannel): # will unilaterally close the channel and time out the HTLC offered_htlc_deadline = lnutil.NBLOCK_DEADLINE_AFTER_EXPIRY_FOR_OFFERED_HTLCS for sub, dir, ctn in ((LOCAL, SENT, self.get_latest_ctn(LOCAL)), - (REMOTE, RECEIVED, self.get_oldest_unrevoked_ctn(LOCAL)), - (REMOTE, RECEIVED, self.get_latest_ctn(LOCAL)),): + (REMOTE, RECEIVED, self.get_oldest_unrevoked_ctn(REMOTE)), + (REMOTE, RECEIVED, self.get_latest_ctn(REMOTE)),): for htlc_id, htlc in self.hm.htlcs_by_direction(subject=sub, direction=dir, ctn=ctn).items(): if htlc.cltv_expiry + offered_htlc_deadline > local_height: continue diff --git a/electrum/lnhtlc.py b/electrum/lnhtlc.py index e71482642..a7f2916c1 100644 --- a/electrum/lnhtlc.py +++ b/electrum/lnhtlc.py @@ -19,7 +19,7 @@ class HTLCManager: 'locked_in': {}, # "side who offered htlc" -> action -> htlc_id -> whose ctx -> ctn 'settles': {}, # "side who offered htlc" -> action -> htlc_id -> whose ctx -> ctn 'fails': {}, # "side who offered htlc" -> action -> htlc_id -> whose ctx -> ctn - 'fee_updates': {}, # "side who initiated fee update" -> action -> list of FeeUpdates + 'fee_updates': {}, # "side who initiated fee update" -> index -> list of FeeUpdates 'revack_pending': False, 'next_htlc_id': 0, 'ctn': -1, # oldest unrevoked ctx of sub diff --git a/electrum/lnpeer.py b/electrum/lnpeer.py index f82535cbb..882d7d64b 100644 --- a/electrum/lnpeer.py +++ b/electrum/lnpeer.py @@ -1896,7 +1896,7 @@ class Peer(Logger): self.logger.info("FEES HAVE FALLEN") elif feerate_per_kw > chan_fee * 2: self.logger.info("FEES HAVE RISEN") - elif chan.get_oldest_unrevoked_ctn(REMOTE) == 0: + elif chan.get_latest_ctn(REMOTE) == 0: # workaround eclair issue https://github.com/ACINQ/eclair/issues/1730 self.logger.info("updating fee to bump remote ctn") if feerate_per_kw == chan_fee: diff --git a/electrum/lnwatcher.py b/electrum/lnwatcher.py index c7c792b00..6e81f3f3b 100644 --- a/electrum/lnwatcher.py +++ b/electrum/lnwatcher.py @@ -431,7 +431,7 @@ class LNWalletWatcher(LNWatcher): closing_txid=closing_txid, closing_height=closing_height, keep_watching=keep_watching) - await self.lnworker.on_channel_update(chan) + await self.lnworker.handle_onchain_state(chan) @log_exceptions async def do_breach_remedy(self, funding_outpoint, closing_tx, spenders): diff --git a/electrum/lnworker.py b/electrum/lnworker.py index 2427465f4..c0021b486 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -609,7 +609,7 @@ class LNGossip(LNWorker): orphaned_ids = [c['short_channel_id'] for c in orphaned] await self.add_new_ids(orphaned_ids) if categorized_chan_upds.good: - self.logger.debug(f'on_channel_update: {len(categorized_chan_upds.good)}/{len(chan_upds)}') + self.logger.debug(f'process_gossip: {len(categorized_chan_upds.good)}/{len(chan_upds)}') class LNWallet(LNWorker): @@ -985,7 +985,7 @@ class LNWallet(LNWorker): if chan.funding_outpoint.to_str() == txo: return chan - async def on_channel_update(self, chan: Channel): + async def handle_onchain_state(self, chan: Channel): if type(chan) is ChannelBackup: util.trigger_callback('channel', self.wallet, chan) return