From 23f158291c4f4afde186f31c927a41a015333083 Mon Sep 17 00:00:00 2001 From: f321x Date: Mon, 8 Sep 2025 13:37:27 +0200 Subject: [PATCH] lnwatcher: catch callback exceptions Catch exceptions happening to callbacks to continue calling the remaining callbacks. Otherwise if the first callback throws an exception the remaining callbacks aren't going to be called. --- electrum/lnwatcher.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/electrum/lnwatcher.py b/electrum/lnwatcher.py index 6a4842c09..14ee2750f 100644 --- a/electrum/lnwatcher.py +++ b/electrum/lnwatcher.py @@ -56,7 +56,10 @@ class LNWatcher(Logger, EventListener): self.logger.info("synchronizer not set yet") return for address, callback in list(self.callbacks.items()): - await callback() + try: + await callback() + except Exception: + self.logger.exception(f"LNWatcher callback failed {address=}") # send callback to GUI util.trigger_callback('wallet_updated', self.lnworker.wallet)