pytest: be sure that we receive error on datalose failure.

It was intermittant before: I added a sleep(1) in the code before
sending the error (temporarily) to make it always triggers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-10-22 14:37:32 +10:30
parent f44c1971a5
commit 6fdaec313d
2 changed files with 3 additions and 3 deletions

View File

@ -4437,6 +4437,7 @@ static void check_future_dataloss_fields(struct peer *peer,
take(towire_channeld_fail_fallen_behind(NULL,
remote_current_per_commitment_point)));
sleep(1);
/* We have to send them an error to trigger dropping to chain. */
peer_failed_err(peer->pps, &peer->channel_id,
"Awaiting unilateral close");

View File

@ -3055,9 +3055,8 @@ def test_dataloss_protection(node_factory, bitcoind):
assert not l2.daemon.is_in_log('sendrawtx exit 0',
start=l2.daemon.logsearch_start)
# l1 should drop to chain, but doesn't always receive ERROR before it sends warning.
# We have to reconnect once
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
# l1 should receive error and drop to chain
l1.daemon.wait_for_log("They sent ERROR.*Awaiting unilateral close")
l1.wait_for_channel_onchain(l2.info['id'])
closetxid = only_one(bitcoind.rpc.getrawmempool(False))