Skip to content

Reconstruct ChannelManager forwarded HTLCs maps from Channels#4227

Merged
valentinewallace merged 9 commits intolightningdevkit:mainfrom
valentinewallace:2025-10-reconstruct-mgr-fwd-htlcs
Dec 11, 2025
Merged

Reconstruct ChannelManager forwarded HTLCs maps from Channels#4227
valentinewallace merged 9 commits intolightningdevkit:mainfrom
valentinewallace:2025-10-reconstruct-mgr-fwd-htlcs

Conversation

@valentinewallace
Copy link
Copy Markdown
Contributor

@valentinewallace valentinewallace commented Nov 17, 2025

We have an overarching goal of (mostly) getting rid of ChannelManager persistence and rebuilding the ChannelManager's state from existing ChannelMonitors, due to issues when the two structs are out-of-sync on restart. The main issue that can arise is channel force closure.

Here we start this process by rebuilding ChannelManager::decode_update_add_htlcs, forward_htlcs, and pending_intercepted_htlcs from the Channels, which will soon be included in the ChannelMonitors as part of #4218.

  • test upgrading from a manager containing pending HTLC forwards that was serialized on <= LDK 0.2, i.e. where Channels will not contain committed update_add_htlcs
  • currently, no tests fail when we force using the new rebuilt decode_update_add_htlcs map and ignoring the legacy maps. This may indicate missing test coverage, since in theory we need to re-forward these HTLCs sometimes so they go back in the forward_htlcs map for processing
  • only use the old legacy maps if the manager and its channels were last serialized on <= 0.2. Currently this is not guaranteed

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants