tlnworker: catch exceptions raised in decode_msg - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 1788e5c1c094390958ee91a74aa3f048ba1e9a0c DIR parent 6aeab664637681afcaba9f4384091386d57a5a50 HTML Author: ThomasV <thomasv@electrum.org> Date: Mon, 11 May 2020 10:31:49 +0200 lnworker: catch exceptions raised in decode_msg Diffstat: M electrum/lnworker.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- DIR diff --git a/electrum/lnworker.py b/electrum/lnworker.py t@@ -811,6 +811,7 @@ class LNWallet(LNWorker): if chan.short_channel_id == short_channel_id: return chan + @log_exceptions async def _pay(self, invoice: str, amount_sat: int = None, *, attempts: int = 1, full_path: LNPaymentPath = None) -> Tuple[bool, List[PaymentAttemptLog]]: t@@ -928,12 +929,13 @@ class LNWallet(LNWorker): assert payload['chain_hash'] == constants.net.rev_genesis_bytes() payload['raw'] = channel_update_typed except: # FIXME: too broad - message_type, payload = decode_msg(channel_update_as_received) - payload['raw'] = channel_update_as_received - # sanity check - if payload['chain_hash'] != constants.net.rev_genesis_bytes(): - self.logger.info(f'could not decode channel_update for failed htlc: {channel_update_as_received.hex()}') - return True + try: + message_type, payload = decode_msg(channel_update_as_received) + payload['raw'] = channel_update_as_received + assert payload['chain_hash'] != constants.net.rev_genesis_bytes() + except: + 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'])