-
Notifications
You must be signed in to change notification settings - Fork 417
Add splice-out support #3979
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
base: main
Are you sure you want to change the base?
Add splice-out support #3979
Conversation
🎉 This PR is now ready for review! |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3979 +/- ##
==========================================
- Coverage 88.94% 88.93% -0.02%
==========================================
Files 174 174
Lines 124200 124211 +11
Branches 124200 124211 +11
==========================================
- Hits 110471 110462 -9
- Misses 11253 11261 +8
- Partials 2476 2488 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
acab158
to
2d39059
Compare
Splice contributions should never exceed the total bitcoin supply. This check prevents a potential overflow when converting the contribution from sats to msats. The commit additionally begins to store the contribution using SignedAmount.
…text Once the counterparty supplies their funding contribution, there is no longer a need to store it in FundingNegotiationContext as it will have already been used to create a FundingScope.
Specify what inputs and outputs to contribute to a funding transaction using an enum. This will make the splice-in and upcoming splice-out use cases explicit.
TransactionU16LenLimited was used to limit Transaction serialization size to u16::MAX. This was because messages can not be longer than u16::MAX bytes when serialized for the transport layer. However, this limit doesn't take into account other fields in a message containing a Transaction, including the length of the transaction itself. Remove TransactionU16LenLimited and instead check any user supplied transactions in the context of the enclosing message (e.g. TxAddInput).
In preparation for having ChannelManager::splice_channel take FundingTxContributions, add a weight to the FundingTxContributions::InputsOnly, which supports the splice-in use case.
Using FundingTxContributions for ChannelManager::splice_channel allows supporting both splice-in and splice-out using the same method, with a descriptive enum for the contributions.
Update FundingTxContributions with a variant used to support splice-out (i.e., removing funds from a channel). The TxOut values must not exceed the users channel balance after accounting for fees and the reserve requirement.
2d39059
to
381fba6
Compare
Splice-in support was added in #3736. This PR expands
ChannelManager::splice_channel
to support splice-out (i.e., removing funds from a channel). This is accomplished by adding aFundingTxContributions
enum to cover both use cases.Depends on #3736.