Skip to content

Split prefunded Channel into Inbound/Outbound channels#2077

Merged
TheBlueMatt merged 25 commits intolightningdevkit:mainfrom
dunxen:2023-02-splitchannelstate
Jun 16, 2023
Merged

Split prefunded Channel into Inbound/Outbound channels#2077
TheBlueMatt merged 25 commits intolightningdevkit:mainfrom
dunxen:2023-02-splitchannelstate

Conversation

@dunxen
Copy link
Copy Markdown
Contributor

@dunxen dunxen commented Mar 6, 2023

Currently, funded and unfunded channels are represented by a single Channel struct. This ends up conflating certain state and makes it harder to reason about / less safe to call appropriate methods on Channel to advance state.

This aims to make prefunded vs. funded states more type-safe and logically separated. Prefunded channels are further split into InboundChannels and OutboundChannels. This makes it a compile-time error to call methods only meant for InboundChannels on OutboundChannels and vice versa. This Inbound/Outbound separation for channels using V1 channel establishment is still very useful when it comes to V2 channel establishment (dual-funded channels): it enhances type safety for what actions the V2 channel initiator (Outbound) and non-iniator (Inbound) can take on these objects once they support V2 channel establishment in future work.

Partially addresses #1621

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants