From 982443eaa3d866a2c9dee912cd4e233782f599d8 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Wed, 5 Jun 2024 16:49:33 +0200 Subject: [PATCH] maybe_cleanup_forwarding: fix crash if payment_key not in self.received_mpp_htlcs --- electrum/lnworker.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/electrum/lnworker.py b/electrum/lnworker.py index c1bb83f8c..2b4e24df3 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -2380,10 +2380,10 @@ class LNWallet(LNWorker): is_htlc_key = ':' in payment_key_hex if not is_htlc_key: payment_key = bytes.fromhex(payment_key_hex) - mpp_status = self.received_mpp_htlcs[payment_key] - if mpp_status.resolution == RecvMPPResolution.WAITING: - # reconstructing the MPP after restart - self.logger.info(f'cannot cleanup mpp, still waiting') + mpp_status = self.received_mpp_htlcs.get(payment_key) + if not mpp_status or mpp_status.resolution == RecvMPPResolution.WAITING: + # After restart, self.received_mpp_htlcs needs to be reconstructed + self.logger.info(f'maybe_cleanup_forwarding: mpp_status not ready') return htlc_key = (short_channel_id, htlc) mpp_status.htlc_set.remove(htlc_key) # side-effecting htlc_set