Skip to content

Commit 03bb0ba

Browse files
test: fix test_restorefrompeer for no-disconnect on unknown reestablish
Since we no longer disconnect when receiving a channel_reestablish for an unknown channel, the test needs to explicitly disconnect and reconnect after restorefrompeer() so the stub channel triggers the bogus channel_reestablish flow in peer_connected_hook_final. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7829e26 commit 03bb0ba

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

tests/test_misc.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3276,17 +3276,18 @@ def test_restorefrompeer(node_factory, bitcoind):
32763276
l1.start()
32773277
assert l1.daemon.is_in_log('Server started with public key')
32783278

3279-
# If this happens fast enough, connect fails with "disconnected
3280-
# during connection"
3281-
try:
3282-
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
3283-
except RpcError as err:
3284-
assert "disconnected during connection" in err.error['message']
3279+
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
32853280

32863281
l1.daemon.wait_for_log('peer_in WIRE_PEER_STORAGE_RETRIEVAL')
32873282

32883283
assert l1.rpc.restorefrompeer()['stubs'][0] == _['channel_id']
32893284

3285+
# We need to reconnect so the stub channel triggers the bogus
3286+
# channel_reestablish flow in peer_connected_hook_final.
3287+
# (l1 no longer disconnects on unknown channel_reestablish.)
3288+
l1.rpc.disconnect(l2.info['id'], force=True)
3289+
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
3290+
32903291
l1.daemon.wait_for_log('Sending a bogus channel_reestablish message to make the peer unilaterally close the channel.')
32913292
l1.daemon.wait_for_log('peer_out WIRE_ERROR')
32923293

0 commit comments

Comments
 (0)