pytest: further deflake test_funding_push.

I also got an error under CI; it seems the sleep() was insufficient.
So try adding a sleep inside the check_coin_moves, which should cover
everyone.

```
                acct_moves = acct_moves[number_moves:]
            else:
>               if not move_matches(m, acct_moves[0]):
E               IndexError: list index out of range
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-12-29 14:11:15 +10:30
parent ae4669f77f
commit b659fbbdf7
2 changed files with 14 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ from pyln.testing.utils import env, only_one, wait_for, write_config, TailablePr
import bitstring
from pyln.client import Millisatoshi
from pyln.testing.utils import EXPERIMENTAL_DUAL_FUND
import time
EXPERIMENTAL_FEATURES = env("EXPERIMENTAL_FEATURES", "0") == "1"
COMPAT = env("COMPAT", "1") == "1"
@@ -108,6 +109,19 @@ def check_balance_snaps(n, expected_bals):
def check_coin_moves(n, account_id, expected_moves, chainparams):
moves = n.rpc.call('listcoinmoves_plugin')['coin_moves']
# moves can lag; wait for a few seconds if we don't have correct number.
# then move on: we'll get details below.
expected_count = 0
for m in enumerate(expected_moves):
if isinstance(m, list):
expected_count += len(m)
else:
expected_count += 1
if len(moves) != expected_count:
time.sleep(5)
moves = n.rpc.call('listcoinmoves_plugin')['coin_moves']
node_id = n.info['id']
acct_moves = [m for m in moves if m['account_id'] == account_id]
for mv in acct_moves: