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
```
This commit is contained in:
@@ -40,7 +40,8 @@ from electrum.logging import Logger
|
|||||||
from electrum.plugin import BasePlugin
|
from electrum.plugin import BasePlugin
|
||||||
from electrum.transaction import PartialTransaction, tx_from_any
|
from electrum.transaction import PartialTransaction, tx_from_any
|
||||||
from electrum.util import (
|
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
|
from electrum.wallet import Multisig_Wallet
|
||||||
|
|
||||||
@@ -250,7 +251,7 @@ class CosignerWallet(Logger):
|
|||||||
def mark_pending_event_rcvd(self, event_id):
|
def mark_pending_event_rcvd(self, event_id):
|
||||||
self.logger.debug('marking event rcvd')
|
self.logger.debug('marking event rcvd')
|
||||||
self.known_events[event_id] = now()
|
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]]:
|
def prepare_messages(self, tx: Union[Transaction, PartialTransaction], label: str = None) -> List[Tuple[str, dict]]:
|
||||||
messages = []
|
messages = []
|
||||||
|
|||||||
Reference in New Issue
Block a user