Skip to content

Commit ad5a05c

Browse files
Jolah1claude
andcommitted
Retry the close in lsps2_service_prunes_closed_channel_state
The client closes its JIT channel right after `PaymentReceived`, while it may still be persisting the monitor updates for settling the HTLC it just claimed. LDK won't begin a cooperative shutdown while a monitor update is in flight, so under load `close_channel` failed with `ChannelClosingFailed`. Retry it until the updates are through, polling like the test already does for the pruning. This change was written with the assistance of Claude Code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 6a47fb1 commit ad5a05c

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎tests/integration_tests_rust.rs‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8790,7 +8790,15 @@ async fn lsps2_service_prunes_closed_channel_state() {
87908790

87918791
assert_eq!(list_lsps2_peer_states().await, vec![client_node.node_id().to_string()]);
87928792

8793-
client_node.close_channel(&client_user_channel_id, service_node.node_id()).unwrap();
8793+
// The client may still be persisting the monitor updates for the claim it just made, and LDK
8794+
// won't begin a cooperative shutdown while one is in flight.
8795+
tokio::time::timeout(Duration::from_secs(common::INTEROP_TIMEOUT_SECS), async {
8796+
while client_node.close_channel(&client_user_channel_id, service_node.node_id()).is_err() {
8797+
tokio::time::sleep(Duration::from_millis(100)).await;
8798+
}
8799+
})
8800+
.await
8801+
.expect("the client should be able to close the channel");
87948802
expect_event!(client_node, ChannelClosed);
87958803
expect_event!(service_node, ChannelClosed);
87968804

0 commit comments

Comments
 (0)