electrum icon indicating copy to clipboard operation
electrum copied to clipboard

Submarine swap issue

Open s1ckoleg opened this issue 2 years ago • 0 comments

Hi, I'm trying to run normal swap on signet, but facing an issue.

I have opened channel:

 {
        "channel_id": "3ca789a76b3f53878d11fb1ad363cee110f043389c6ce8bb16c0881e1a495f3d",
        "channel_point": "3f5f491a1e88c016bbe86c9c3843f010e1ce63d31afb118d87533f6ba789a73c:2",
        "local_balance": 999997,
        "local_ctn": 7,
        "local_reserve": 10000,
        "local_unsettled_sent": 0,
        "peer_state": "GOOD",
        "remote_balance": 2,
        "remote_ctn": 7,
        "remote_pubkey": "03ddab321b760433cbf561b615ef62ac7d318630c5f51d523aaf5395b90b751956",
        "remote_reserve": 10000,
        "remote_unsettled_sent": 0,
        "short_channel_id": "224276x11x2",
        "state": "OPEN",
        "type": "CHANNEL"
    }

But when I try to perform normal_swap:

electrum --signet -w $wallets/test.wallet normal_swap 0.00000001 0.00000001 --password xxx

I get the following error:

(inside daemon): Traceback (most recent call last):
  File "/root/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 1109, in _wrap_create_connection
    sock = await aiohappyeyeballs.start_connection(
  File "/root/.local/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 104, in start_connection
    raise first_exception
  File "/root/.local/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 82, in start_connection
    sock = await _connect_sock(
  File "/root/.local/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 174, in _connect_sock
    await loop.sock_connect(sock, address)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
    return await fut
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 5455)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/.local/lib/python3.10/site-packages/electrum/daemon.py", line 254, in handle
    response['result'] = await f(*params)
  File "/root/.local/lib/python3.10/site-packages/electrum/daemon.py", line 361, in run_cmdline
    result = await func(*args, **kwargs)
  File "/root/.local/lib/python3.10/site-packages/electrum/commands.py", line 168, in func_wrapper
    return await func(*args, **kwargs)
  File "/root/.local/lib/python3.10/site-packages/electrum/commands.py", line 1320, in normal_swap
    txid = await wallet.lnworker.swap_manager.normal_swap(
  File "/root/.local/lib/python3.10/site-packages/electrum/submarine_swaps.py", line 621, in normal_swap
    swap, invoice = await self.request_normal_swap(
  File "/root/.local/lib/python3.10/site-packages/electrum/submarine_swaps.py", line 644, in request_normal_swap
    data = await self.send_request_to_server('createnormalswap', request_data)
  File "/root/.local/lib/python3.10/site-packages/electrum/submarine_swaps.py", line 584, in send_request_to_server
    response = await self.network.async_send_http_on_proxy(
  File "/root/.local/lib/python3.10/site-packages/electrum/network.py", line 1449, in async_send_http_on_proxy
    async with session.post(url, json=json, headers=headers) as resp:
  File "/root/.local/lib/python3.10/site-packages/aiohttp/client.py", line 1423, in __aenter__
    self._resp: _RetType = await self._coro
  File "/root/.local/lib/python3.10/site-packages/aiohttp/client.py", line 701, in _request
    conn = await self._connector.connect(
  File "/root/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 544, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/root/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 1050, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/root/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 1394, in _create_direct_connection
    raise last_exc
  File "/root/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 1363, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/root/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 1124, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:5455 ssl:default [Connect call failed ('127.0.0.1', 5455)]

internal error while executing RPC

Seems like it expect a swapserver hosted on my VM. I found this parameter in code, but it doesn't work:

electrum -o setconfig enable_plugin_swapserver True
  0.27 | E | __main__ | error running command (without daemon)
Traceback (most recent call last):
  File "/usr/local/bin/electrum", line 541, in handle_cmd
    result = fut.result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/usr/local/bin/electrum", line 256, in run_offline_command
    result = await func(*args, **kwargs)
  File "/root/.local/lib/python3.10/site-packages/electrum/commands.py", line 168, in func_wrapper
    return await func(*args, **kwargs)
  File "/root/.local/lib/python3.10/site-packages/electrum/commands.py", line 357, in setconfig
    cv = self.config.cv.from_key(key)
  File "/root/.local/lib/python3.10/site-packages/electrum/simple_config.py", line 916, in from_key
    raise KeyError(f"No ConfigVar with key={key!r}") from None
KeyError: "No ConfigVar with key='enable_plugin_swapserver'"

Is it possible to run normal_swap on signet? Is it available on mainnet at the moment?

s1ckoleg avatar Dec 03 '24 18:12 s1ckoleg