commit 2c2d3f3b306833b16b43789b791e856d7924934e parent 4febbcdc2dd772c8e8465bdeee31bd436650a4a3 Author: ThomasV <thomasv@electrum.org> Date: Sun, 7 Feb 2021 12:34:28 +0100 handle_error_from_failed_htlc: blacklist channel if cannot decode payload Diffstat:
M | electrum/lnworker.py | | | 43 | ++++++++++++++++++++++--------------------- |
1 file changed, 22 insertions(+), 21 deletions(-)
diff --git a/electrum/lnworker.py b/electrum/lnworker.py @@ -1055,28 +1055,29 @@ class LNWallet(LNWorker): payload = self._decode_channel_update_msg(channel_update_as_received) if payload is None: self.logger.info(f'could not decode channel_update for failed htlc: {channel_update_as_received.hex()}') - return True - r = self.channel_db.add_channel_update(payload) - blacklist = False - short_channel_id = ShortChannelID(payload['short_channel_id']) - if r == UpdateStatus.GOOD: - self.logger.info(f"applied channel update to {short_channel_id}") - # TODO: test this - for chan in self.channels.values(): - if chan.short_channel_id == short_channel_id: - chan.set_remote_update(payload['raw']) - elif r == UpdateStatus.ORPHANED: - # maybe it is a private channel (and data in invoice was outdated) - self.logger.info(f"Could not find {short_channel_id}. maybe update is for private channel?") - start_node_id = route[sender_idx].node_id - self.channel_db.add_channel_update_for_private_channel(payload, start_node_id) - elif r == UpdateStatus.EXPIRED: - blacklist = True - elif r == UpdateStatus.DEPRECATED: - self.logger.info(f'channel update is not more recent.') - blacklist = True - elif r == UpdateStatus.UNCHANGED: blacklist = True + else: + r = self.channel_db.add_channel_update(payload) + blacklist = False + short_channel_id = ShortChannelID(payload['short_channel_id']) + if r == UpdateStatus.GOOD: + self.logger.info(f"applied channel update to {short_channel_id}") + # TODO: test this + for chan in self.channels.values(): + if chan.short_channel_id == short_channel_id: + chan.set_remote_update(payload['raw']) + elif r == UpdateStatus.ORPHANED: + # maybe it is a private channel (and data in invoice was outdated) + self.logger.info(f"Could not find {short_channel_id}. maybe update is for private channel?") + start_node_id = route[sender_idx].node_id + self.channel_db.add_channel_update_for_private_channel(payload, start_node_id) + elif r == UpdateStatus.EXPIRED: + blacklist = True + elif r == UpdateStatus.DEPRECATED: + self.logger.info(f'channel update is not more recent.') + blacklist = True + elif r == UpdateStatus.UNCHANGED: + blacklist = True else: blacklist = True # blacklist channel after reporter node