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

Update to select funding inputs before sending open_channel2 and splice_init and add excess to requests #2924

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

remyers
Copy link
Contributor

@remyers remyers commented Oct 9, 2024

This is an alternative to PR #2903 which does not assume modifying bitcoind to add excess to a selected output during coin selection (see PR 30080).

When funds are added to a dual funded channel, or spliced into an existing channel, our channel should be credited in their channel balance any excess that is added to the channel over what the user requests. Currently if a changeless solution is found for funding, excess value over what was requested will be treated as waste and used as extra fees.

We introduce a new optional funding contributions parameter to InteractiveTxBuilder. When set, we will start by processing the passed in funding inputs/outputs instead of using InteractiveTxFunder to fund the transaction. The call to InteractiveTxFunder is now made before sending open_channel2 or splice_init and the results are then passed to InteractiveTxBuilder.

This PR builds on PR #2887 - Use final spec values for splicing and should be rebased once the final official splicing code is merged.

@remyers
Copy link
Contributor Author

remyers commented Oct 9, 2024

To compute the excess of from a changeless set of funding inputs, InteractiveTxFunder currently assumes all inputs are p2wpkh in order to compute their weight for the purpose of computing the actual feerate of the funded transaction. We should computer the exact weight of each input, but I couldn't figure out how that can be done. Any suggestions?

…ce_init

 - If a changeless set of inputs is found, excess funding (if any) will be added to the proposed `fundingAmount`/`fundingContribution` before sending `open_channel2`/`splice_init` respectively.
 - InteractiveTxFunder sets `excess_opt` with the input value in excess of what is needed to achieve the requested target feerate.
 - InteractiveTxFunder assumes all inputs are p2wpkh to compute their weight for the purpose of computing the feerate of the funding transaction.
 - We assume our peer requires confirmed inputs. In the future we could add a heuristic for this, but it's safer to assume they want confirmed inputs.
@remyers remyers force-pushed the 2410-funder-first-eclair branch from 986267b to fc86a9f Compare October 22, 2024 10:01
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