From fc2561fd9e8f56e951c2ef94306261660bbc7d2d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 6 Jul 2020 12:16:15 +0930 Subject: [PATCH] pytest: fix test breakage added by d0c85033d2e5fe83861af7badb577e7cef86a310 By setting nLocktime to the current block, the reorg test "test_funding_reorg_remote_lags" actually drops the funding transaction entirely when a reorg happens. Except the 1 in 10 cases where nLocktime is randomly set to 1-10 blocks earlier. This implies, strongly, that we hit "restart" too often on Travis. Signed-off-by: Rusty Russell --- tests/test_misc.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test_misc.py b/tests/test_misc.py index 547d033b2..0f03bffdb 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -1214,9 +1214,11 @@ def test_funding_reorg_remote_lags(node_factory, bitcoind): l2.daemon.rpcproxy.mock_rpc('getblockhash', no_more_blocks) - # Reorg changes short_channel_id 103x1x0 to 103x2x0, l1 sees it, restarts channeld - bitcoind.simple_reorg(102, 1) # heights 102 - 108 - l1.daemon.wait_for_log(r'Peer transient failure .* short_channel_id changed to 103x2x0 \(was 103x1x0\)') + # Reorg changes short_channel_id 103x1x0 to 104x1x0, l1 sees it, restarts channeld + bitcoind.simple_reorg(103, 1) # heights 103 - 108 + # But now it's height 104, we need another block to make it announcable. + bitcoind.generate_block(1) + l1.daemon.wait_for_log(r'Peer transient failure .* short_channel_id changed to 104x1x0 \(was 103x1x0\)') wait_for(lambda: only_one(l2.rpc.listpeers()['peers'][0]['channels'])['status'] == [ 'CHANNELD_NORMAL:Reconnected, and reestablished.', @@ -1226,7 +1228,7 @@ def test_funding_reorg_remote_lags(node_factory, bitcoind): l2.daemon.rpcproxy.mock_rpc('getblockhash', None) wait_for(lambda: [c['active'] for c in l2.rpc.listchannels('103x1x0')['channels']] == [False, False]) - wait_for(lambda: [c['active'] for c in l2.rpc.listchannels('103x2x0')['channels']] == [True, True]) + wait_for(lambda: [c['active'] for c in l2.rpc.listchannels('104x1x0')['channels']] == [True, True]) wait_for(lambda: only_one(l2.rpc.listpeers()['peers'][0]['channels'])['status'] == [ 'CHANNELD_NORMAL:Reconnected, and reestablished.',