1
0

Merge pull request #9933 from f321x/prevent_fail_swap_exception

fix: prevent KeyError if _fail_swap gets called multiple times
This commit is contained in:
ThomasV
2025-06-11 13:09:52 +02:00
committed by GitHub

View File

@@ -361,7 +361,8 @@ class SwapManager(Logger):
self.lnwatcher.remove_callback(swap.lockup_address) self.lnwatcher.remove_callback(swap.lockup_address)
if not swap.is_funded(): if not swap.is_funded():
with self.swaps_lock: with self.swaps_lock:
self._swaps.pop(swap.payment_hash.hex()) if self._swaps.pop(swap.payment_hash.hex(), None) is None:
self.logger.debug(f"swap {swap.payment_hash.hex()} has already been deleted.")
# TODO clean-up other swaps dicts, i.e. undo _add_or_reindex_swap() # TODO clean-up other swaps dicts, i.e. undo _add_or_reindex_swap()
@classmethod @classmethod