Serialize rgb_payment for pending inbound and outbound HTLCs#20
Merged
gofman8 merged 1 commit intoJun 23, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A channel writes the
rgb_paymentfield only for holding-cell HTLCs, but reads it back for pending inbound and outbound HTLCs too. The read and write sides disagree, so the fix simply writesrgb_paymentfor those HTLCs as well — making the two sides symmetric. The read path is unchanged.If a channel is saved while it still has a pending inbound or outbound HTLC, the extra read with no matching write makes the deserializer read past the field, drift, and fail with
DecodeError::InvalidValue. In practice that means the wholeChannelManagercan't be loaded and the node won't restart. It stays hidden as long as HTLCs settle before the channel is saved, and shows up as soon as one is still in flight at save time.Test
Reproduced end-to-end in rgb-lightning-node by
restart_with_pending_rgb_htlc_recovers_channel. It pays a hodl invoice to hold an RGB HTLC open, restarts both nodes, and checks the channel comes back and the payment can be settled. The test fails (InvalidValueon restart) without this fix and passes with it.