Skip to content

Commit 694cbe5

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 4ee1eda commit 694cbe5

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
@@ -3277,17 +3277,18 @@ def test_restorefrompeer(node_factory, bitcoind):
32773277
l1.start()
32783278
assert l1.daemon.is_in_log('Server started with public key')
32793279

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

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

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

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

0 commit comments

Comments
 (0)