Skip to content

Bump rust-lightning for peer_connected race condition diagnostics#8

Merged
martinsaposnic merged 1 commit intolsp-0.7.0from
bump-rust-lightning-race-diagnostics
Mar 2, 2026
Merged

Bump rust-lightning for peer_connected race condition diagnostics#8
martinsaposnic merged 1 commit intolsp-0.7.0from
bump-rust-lightning-race-diagnostics

Conversation

@martinsaposnic
Copy link

Summary

  • Bump rust-lightning dependency from 68c0e4d to 145438f9f to pick up diagnostic logging for the peer_connected / ChannelReestablish race condition

What changed upstream

PR: moneydevkit/rust-lightning#3

Production logs show HTLCs silently failing because peer_connected fires before channel_reestablish completes. forward_intercepted_htlc checks is_usable() (passes) but send_htlc later checks is_peer_disconnected() (fails). The HTLC is failed back to the payer with no LSPS4-level error.

The upstream PR adds end-to-end logging at every step:

  • LSPS4 service: peer_connected, peer_disconnected, channel_ready, htlc_intercepted, execute_htlc_actions, calculate_htlc_actions, handle_expired_htlcs - all now log channel is_usable/is_channel_ready state
  • LDK forward_intercepted_htlc: logs is_usable vs is_live vs is_connected, emits WARNING when is_usable && !is_live
  • LDK channel_reestablish: logs when clear_peer_disconnected() fires (channel becomes live)
  • LDK send_htlc: logs when HTLC is rejected due to peer_disconnected
  • LDK process_forward_htlcs: logs channel liveness before queue_add_htlc

Grafana queries after deploying

Query What it proves
forward_intercepted_htlc.*is_usable: true.*is_live: false Race condition in action
send_htlc: REJECTING HTLC.*peer_disconnected Silent failure now visible
peer_connected.*is_usable: false Channels not ready at peer_connected time
channel_reestablish: clearing peer_disconnected When channel actually becomes live

Test plan

  • cargo build - clean (warnings are pre-existing)
  • Deploy to staging and check Grafana for key log patterns

Update rust-lightning rev to 145438f9f which adds diagnostic logging
across LSPS4 service and LDK core to prove and quantify the
peer_connected / ChannelReestablish race condition.

See: moneydevkit/rust-lightning#3
@martinsaposnic martinsaposnic force-pushed the bump-rust-lightning-race-diagnostics branch from af5d838 to 427a91f Compare March 2, 2026 17:54
@martinsaposnic martinsaposnic merged commit 9dd57f4 into lsp-0.7.0 Mar 2, 2026
6 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant