Skip to content

Commit 052542e

Browse files
committed
pytest: Stabilize the test_recover_plugin test
1 parent e2aa4f1 commit 052542e

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

tests/test_misc.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2812,11 +2812,25 @@ def test_emergencyrecover(node_factory, bitcoind):
28122812
@pytest.mark.openchannel('v1')
28132813
@pytest.mark.openchannel('v2')
28142814
def test_recover_plugin(node_factory, bitcoind):
2815-
l1 = node_factory.get_node(may_reconnect=True, options={'log-level': 'info', 'experimental-peer-storage': None},
2816-
allow_warning=True,
2817-
feerates=(7500, 7500, 7500, 7500))
2818-
l2 = node_factory.get_node(may_reconnect=True, options={'log-level': 'info', 'experimental-peer-storage': None},
2819-
feerates=(7500, 7500, 7500, 7500), allow_broken_log=True, allow_bad_gossip=True)
2815+
l1 = node_factory.get_node(
2816+
may_reconnect=True,
2817+
allow_warning=True,
2818+
feerates=(7500, 7500, 7500, 7500),
2819+
options={
2820+
'log-level': 'info',
2821+
'experimental-peer-storage': None
2822+
},
2823+
)
2824+
l2 = node_factory.get_node(
2825+
may_reconnect=True,
2826+
feerates=(7500, 7500, 7500, 7500),
2827+
allow_broken_log=True,
2828+
allow_bad_gossip=True,
2829+
options={
2830+
'log-level': 'info',
2831+
'experimental-peer-storage': None
2832+
},
2833+
)
28202834

28212835
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
28222836
l2.fundchannel(l1, 10**6)
@@ -2845,6 +2859,12 @@ def test_recover_plugin(node_factory, bitcoind):
28452859

28462860
l2.start()
28472861

2862+
# Force a reconnect, so l2 learns that it went back in time.
2863+
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
2864+
2865+
# Starting the node again causes it to reconnect, and discover
2866+
# that it lost state. This in turn causes the peer to close the
2867+
# channel for us. Here we wait for the close transaction.
28482868
bitcoind.generate_block(5, wait_for_mempool=1)
28492869
sync_blockheight(bitcoind, [l1, l2])
28502870

0 commit comments

Comments
 (0)