From 0d380218a65bb2e977d9def8c0b0f2ffc34668da Mon Sep 17 00:00:00 2001 From: f321x Date: Mon, 5 Jan 2026 16:02:14 +0100 Subject: [PATCH] bug: psbt_nostr: set CosignerWallet.pending on aio loop Fixes: ``` Traceback (most recent call last): File "/home/user/code/electrum-fork/electrum/plugins/psbt_nostr/qt.py", line 149, in on_receive self.mark_pending_event_rcvd(event_id) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^ File "/home/user/code/electrum-fork/electrum/plugins/psbt_nostr/psbt_nostr.py", line 254, in mark_pending_event_rcvd self.pending.set() ~~~~~~~~~~~~~~~~^^ File "/usr/lib64/python3.14/asyncio/locks.py", line 192, in set fut.set_result(True) ~~~~~~~~~~~~~~^^^^^^ File "/usr/lib64/python3.14/asyncio/base_events.py", line 829, in call_soon self._check_thread() ~~~~~~~~~~~~~~~~~~^^ File "/usr/lib64/python3.14/asyncio/base_events.py", line 866, in _check_thread raise RuntimeError( "Non-thread-safe operation invoked on an event loop other " "than the current one") RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one ``` --- electrum/plugins/psbt_nostr/psbt_nostr.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/electrum/plugins/psbt_nostr/psbt_nostr.py b/electrum/plugins/psbt_nostr/psbt_nostr.py index fed2a8a01..6d45349bf 100644 --- a/electrum/plugins/psbt_nostr/psbt_nostr.py +++ b/electrum/plugins/psbt_nostr/psbt_nostr.py @@ -40,7 +40,8 @@ from electrum.logging import Logger from electrum.plugin import BasePlugin from electrum.transaction import PartialTransaction, tx_from_any from electrum.util import ( - log_exceptions, OldTaskGroup, ca_path, trigger_callback, event_listener, json_decode, make_aiohttp_proxy_connector + log_exceptions, OldTaskGroup, ca_path, trigger_callback, event_listener, json_decode, + make_aiohttp_proxy_connector, run_sync_function_on_asyncio_thread, ) from electrum.wallet import Multisig_Wallet @@ -250,7 +251,7 @@ class CosignerWallet(Logger): def mark_pending_event_rcvd(self, event_id): self.logger.debug('marking event rcvd') self.known_events[event_id] = now() - self.pending.set() + run_sync_function_on_asyncio_thread(self.pending.set, block=False) def prepare_messages(self, tx: Union[Transaction, PartialTransaction], label: str = None) -> List[Tuple[str, dict]]: messages = []