From 6247bee11eb8c2a85e31af629e39e2018f114272 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 26 Jun 2022 14:03:01 +0930 Subject: [PATCH] pytest: try to fix bitcoind socket timeout in test_channel_lease_unilat_closes Split harder! Signed-off-by: Rusty Russell ``` # This can timeout, so do it in four easy stages. for i in range(4): > bitcoind.generate_block(4032 // 4) tests/test_closing.py:971: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ contrib/pyln-testing/pyln/testing/utils.py:475: in generate_block return self.rpc.generatetoaddress(numblocks, to_addr) contrib/pyln-testing/pyln/testing/utils.py:372: in f res = proxy._call(name, *args) /opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/bitcoin/rpc.py:233: in _call response = self._get_response() /opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/bitcoin/rpc.py:263: in _get_response http_response = self.__conn.getresponse() /opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/http/client.py:1373: in getresponse response.begin() /opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/http/client.py:319: in begin version, status, reason = self._read_status() /opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/http/client.py:280: in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = b = def readinto(self, b): """Read up to len(b) bytes into the writable buffer *b* and return the number of bytes read. If the socket is non-blocking and no bytes are available, None is returned. If *b* is non-empty, a 0 return value indicates that the connection was shutdown at the other end. """ self._checkClosed() self._checkReadable() if self._timeout_occurred: raise OSError("cannot read from timed out object") while True: try: > return self._sock.recv_into(b) E socket.timeout: timed out ``` Signed-off-by: Rusty Russell --- tests/test_closing.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_closing.py b/tests/test_closing.py index 896ff0ca0..8a763d1b1 100644 --- a/tests/test_closing.py +++ b/tests/test_closing.py @@ -966,10 +966,10 @@ def test_channel_lease_unilat_closes(node_factory, bitcoind): # we *can* spend the 1csv lock one l2.rpc.withdraw(l2.rpc.newaddr()['bech32'], "all", utxos=[utxo3]) - # This can timeout, so do it in four easy stages. - for i in range(4): - bitcoind.generate_block(4032 // 4) - sync_blockheight(bitcoind, [l2, l3]) + # This can timeout, so do it in easy stages. + for i in range(16): + bitcoind.generate_block(4032 // 16) + sync_blockheight(bitcoind, [l2, l3]) l2.rpc.withdraw(l2.rpc.newaddr()['bech32'], "all", utxos=[utxo1])