spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.4k stars 3.08k forks source link

uninformative message when peer is offline during channel closure #7248

Open zoedberg opened 3 years ago

zoedberg commented 3 years ago

Calling close_channel while the remote peer is offline (and without forcing closure), electrum returns:

{'id': 0, 'jsonrpc': '2.0', 'error': {'code': 1, 'message': "b'\\x02\\xff\\x8fb\\x92\\x8b\\x02w@\\xd2\\xaft\\xb4\\x15\\x91\\xac\\xca2%\\xa0\\x8c\\xfbNT\\xf2\\xadC\\x9a\\x90\\xa2(|8'"}}

I think the error message should be more clear on what the problem is.

This has been tested with electrum 4.1.0 and using JSON-RPC.

SomberNight commented 3 years ago

Could you please check the debug logs and see if you have a traceback?

Note that the electrum daemon has a long lived python process, and the cli client has a short lived python process, and both log. Although if you are using JSON-RPC directly, you only have the former.

zoedberg commented 3 years ago

Yep, there's a traceback:

E | daemon.CommandsServer | internal error while executing RPC
Traceback (most recent call last):
  File "/srv/app/.local/lib/python3.7/site-packages/electrum/daemon.py", line 207, in handle
    response['result'] = await f(**params)
  File "/srv/app/.local/lib/python3.7/site-packages/electrum/commands.py", line 144, in func_wrapper
    return await func(*args, **kwargs)
  File "/srv/app/.local/lib/python3.7/site-packages/electrum/commands.py", line 1069, in close_channel
    return await coro
  File "/srv/app/.local/lib/python3.7/site-packages/electrum/lnworker.py", line 1405, in close_channel
    peer = self._peers[chan.node_id]
KeyError: b'\x02\xff\x8fb\x92\x8b\x02w@\xd2\xaft\xb4\x15\x91\xac\xca2%\xa0\x8c\xfbNT\xf2\xadC\x9a\x90\xa2(|8'