[Draft] Combine FundedChannel and PendingV2Channel through traits#3702
[Draft] Combine FundedChannel and PendingV2Channel through traits#3702optout21 wants to merge 4 commits intolightningdevkit:mainfrom
Conversation
|
👋 Thanks for assigning @jkczyz as a reviewer! |
|
🔔 1st Reminder Hey @jkczyz! This PR has been waiting for your review. |
|
🔔 2nd Reminder Hey @jkczyz! This PR has been waiting for your review. |
|
Simpler version created: #3720 |
|
🔔 3rd Reminder Hey @jkczyz! This PR has been waiting for your review. |
|
👋 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. |
|
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