Skip to content

Commit

Permalink
fix: pass the timeout when we are waiting a node to start
Browse files Browse the repository at this point in the history
Thsi fix a bug that was reported with slower machine
the core lightning is not fast enought to start and
so it fails.

This PR allow to pass a custom timeout to the wait_for function.

```
self = <pyln.client.lightning.UnixSocket object at 0x7ff95de096c0>

    def connect(self) -> None:
        try:
            self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
>           self.sock.connect(str(self.path))
E           FileNotFoundError: [Errno 2] No such file or directory

../../../../anaconda3/envs/lnpro/lib/python3.10/site-packages/pyln/client/lightning.py:234: FileNotFoundError

------------------------------ Captured log call -------------------------------
ERROR    root:clightning.py:441 Short read reading the message length: 18 != 0
ERROR    root:clightning.py:441 Short read reading the message length: 18 != 0
=========================== short test summary info ============================
FAILED tests/test_bolt1-01-init.py::test_init_fail_ask_for_option_data_loss_protect - FileNotFoundError: [Errno 2] No such file or directory
```

Link: https://discord.com/channels/899980449231814676/941465665540325397/1112049895008899173
Signed-off-by: Vincenzo Palazzo <[email protected]>
  • Loading branch information
vincenzopalazzo committed Jun 1, 2023
1 parent 554659f commit 9b4a0c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lnprototest/clightning/clightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from lnprototest import wait_for
from typing import Dict, Any, Callable, List, Optional, cast

TIMEOUT = int(os.getenv("TIMEOUT", "30"))
TIMEOUT = int(os.getenv("TIMEOUT", "60"))
LIGHTNING_SRC = os.path.join(os.getcwd(), os.getenv("LIGHTNING_SRC", "../lightning/"))


Expand Down Expand Up @@ -175,7 +175,7 @@ def node_ready(rpc: pyln.client.LightningRpc) -> bool:
logging.debug(f"waiting for core-lightning: Exception received {ex}")
return False

wait_for(lambda: node_ready(self.rpc))
wait_for(lambda: node_ready(self.rpc), timeout=TIMEOUT)
logging.debug("Waited for core-lightning")

# Make sure that we see any funds that come to our wallet
Expand Down

0 comments on commit 9b4a0c1

Please sign in to comment.