Make RGB channel funding restart-safe - #32
Draft
Jainakin wants to merge 5 commits into
Draft
Conversation
This was referenced Aug 10, 2026
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.
Summary
Make inbound RGB channel funding transactional across process failure, monitor persistence, signer delay, reconnect, and retry.
The change replaces the previous one-shot
FundingCreatedacceptance path with an explicit prepare, promote, finalize, rollback, and startup-reconciliation protocol.funding_signedis not released until both the initial channel monitor and the staged RGB state are durable. Persisted completion actions allow interrupted work to resume after restart without accepting the same RGB allocation twice.It also restores the RGB-aware test surface that had drifted behind the UTEXO LDK fork, including route, wire-format, monitor serialization, signer, and fixture coverage required to exercise the new state machine.
Root cause
The former path mutated RGB state synchronously during
FundingCreatedand then advanced the Lightning channel independently. A crash, peer disconnect, delayed signer, failed monitor persistence, or replay could therefore leave the RGB stock and LDK channel state on opposite sides of the funding boundary.Safety model
funding_signed.ChannelManagerstartup.Dependencies
The Cargo references intentionally point at the contributor branches while this stack is under review. They must be replaced with merged revisions before release.
Validation
cargo check -p lightning --features _rln_test_hookson the forward port to currentdev.Review notes
This PR is intentionally draft. It is security-sensitive and changes persisted channel state. Merge requires the dependency stack, Linux CI, sanitizer coverage, and downstream RLN interoperability to be green.
The branch also carries compatibility/test repairs needed to compile the UTEXO RGB fork's previously disabled upstream tests. Those changes are visible rather than hidden as generated churn; reviewers can request a further split after the state-machine design is accepted.