From ad5a05c86b3828e2ec43b479819287f8eedcaa6f Mon Sep 17 00:00:00 2001 From: jolah1 Date: Tue, 24 Nov 2026 07:06:24 +0100 Subject: [PATCH] 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 --- tests/integration_tests_rust.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/integration_tests_rust.rs b/tests/integration_tests_rust.rs index 62f0f0e750..1e43a25080 100644 --- a/tests/integration_tests_rust.rs +++ b/tests/integration_tests_rust.rs @@ -8790,7 +8790,15 @@ async fn lsps2_service_prunes_closed_channel_state() { assert_eq!(list_lsps2_peer_states().await, vec![client_node.node_id().to_string()]); - client_node.close_channel(&client_user_channel_id, service_node.node_id()).unwrap(); + // The client may still be persisting the monitor updates for the claim it just made, and LDK + // won't begin a cooperative shutdown while one is in flight. + tokio::time::timeout(Duration::from_secs(common::INTEROP_TIMEOUT_SECS), async { + while client_node.close_channel(&client_user_channel_id, service_node.node_id()).is_err() { + tokio::time::sleep(Duration::from_millis(100)).await; + } + }) + .await + .expect("the client should be able to close the channel"); expect_event!(client_node, ChannelClosed); expect_event!(service_node, ChannelClosed);