Uh oh!
There was an error while loading. Please reload this page.
[Draft] Combine FundedChannel and PendingV2Channel through traits - #3702
[Draft] Combine FundedChannel and PendingV2Channel through traits#3702optout21 wants to merge 4 commits into
Conversation
👋 Thanks for assigning @jkczyz as a reviewer! |
ldk-reviews-bot
commented
Apr 5, 2025
🔔 1st Reminder Hey @jkczyz! This PR has been waiting for your review. |
ldk-reviews-bot
commented
Apr 7, 2025
🔔 2nd Reminder Hey @jkczyz! This PR has been waiting for your review. |
optout21
commented
Apr 8, 2025
Simpler version created: #3720 |
ldk-reviews-bot
commented
Apr 9, 2025
🔔 3rd Reminder Hey @jkczyz! This PR has been waiting for your review. |
ldk-reviews-bot
commented
Apr 9, 2025
👋 The first review has been submitted! Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer. |
optout21
commented
Apr 9, 2025
Closing (in favor of simpler version #3720 ) |
The
RefundingChannel-- used by splicing and possibly dual funding -- can acts as both Funded and Pending (depending on the context). To achieve that, in this PR bothFundedChannelandPendingV2Channelare placed behind traits, so they can be combined easily.This PR is more of a proof-of-concept.
Notes:
FundedChannelmethods are substantial but mostly trivial, changing fields into accessorsself.context_mut().somemethod(&self.funded())), those cases were solved by extra local ref variables or obtaining both context and funding at the same timeWithContextAndFundingfromInitialRemoteCommitmentReceiver, with the original intention thatPendingV2ChannelTraitwould also include it. But this is not the case, asPendingV2ChannelTraitneeds its own funding! So this carve-out is not really needed.My conclusion is that this could be solved in other way:
RefundingChannelinclude a fullFundedChannel, as it is accessed mostly throughas_funded()methodsPendingV2ChannelTraitFundedChannelas it is, no need for trait there