Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split prefunding Channel items into Inbound/Outbound channels #2054

Closed

Conversation

dunxen
Copy link
Contributor

@dunxen dunxen commented Feb 27, 2023

WIP: Still requires some fixes, but creating a draft for early feedback. Also not sure the best way to go about this as it's just going to cause/be affected by maaany merge conflicts, hence earlier feedback. I'd suggest the "view file" feature to check the whole channel.rs file. A lot had to move and change at the same time and GH is not coping with highlighting in the changes view. I think I'd like to split the structs into separate files. It's a little overwhelming.

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, are 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

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 state more type-safe and logically separated.
Prefunded channels are further split into `InboundChannel`s and `OutboundChannel`s.
This makes it a compile-time error to call methods only meant for `InboundChannel`s
on `OutboundChannels` and vice versa. This Inbound/Outbound separation for channels
using V1 channel establishment, are 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.
@dunxen
Copy link
Contributor Author

dunxen commented Feb 28, 2023

Going to close this to reduce noise while I share behaviour properly in ChannelLike trait and apply some other fixes. It's waaay too big.

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