From 3ed6781c9f16b9f666fc07d2a92fbd498c85d4c2 Mon Sep 17 00:00:00 2001 From: tecnovert Date: Wed, 12 Oct 2022 20:48:26 +0200 Subject: [PATCH] Ignore undecryptable messages when expiring. --- basicswap/basicswap.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py index d939619..1d59836 100644 --- a/basicswap/basicswap.py +++ b/basicswap/basicswap.py @@ -3560,12 +3560,17 @@ class BasicSwap(BaseApp): num_messages = 0 num_removed = 0 for msg in ro['messages']: - num_messages += 1 - expire_at = msg['sent'] + msg['ttl'] - if expire_at < now: - options = {'encoding': 'none', 'delete': True} - del_msg = ci_part.json_request(rpc_conn, 'smsg', [msg['msgid'], options]) - num_removed += 1 + try: + num_messages += 1 + expire_at = msg['sent'] + msg['ttl'] + if expire_at < now: + options = {'encoding': 'none', 'delete': True} + del_msg = ci_part.json_request(rpc_conn, 'smsg', [msg['msgid'], options]) + num_removed += 1 + except Exception as e: + if self.debug: + self.log.error(traceback.format_exc()) + continue if num_messages + num_removed > 0: self.log.info('Expired {} / {} messages.'.format(num_removed, num_messages))