From efb66dec9f444a09a348b0c17dd34e1917739991 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sat, 29 Nov 2025 09:12:42 +0000 Subject: [PATCH] proto.xmr.tw.view.action.a_sync_wallets: handle SocketError --- mmgen/proto/xmr/tw/view.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mmgen/proto/xmr/tw/view.py b/mmgen/proto/xmr/tw/view.py index d8f83fb6..a4dcfa52 100755 --- a/mmgen/proto/xmr/tw/view.py +++ b/mmgen/proto/xmr/tw/view.py @@ -83,10 +83,19 @@ class MoneroTwView: class action(TwView.action): async def a_sync_wallets(self, parent): - from ....util import msg, msg_r + from ....util import msg, msg_r, ymsg from ....tw.view import CUR_HOME, ERASE_ALL msg('') - op = xmrwallet_op('sync', parent.cfg, None, None, compat_call=True) + try: + op = xmrwallet_op('sync', parent.cfg, None, None, compat_call=True) + except Exception as e: + if type(e).__name__ == 'SocketError': + import asyncio + ymsg(str(e)) + await asyncio.sleep(2) + msg_r(CUR_HOME + ERASE_ALL) + return False + raise await op.restart_wallet_daemon() await op.main() await parent.get_data()