-
Notifications
You must be signed in to change notification settings - Fork 266
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 single funded channel to select inputs before sending open #2894
Conversation
This change passes `maxExcess` to Peer via OpenChannel and from Peer to Channel via INPUT_INIT_CHANNEL_INITIATOR. The `maxExcess` parameter will be used by bitcoind funding calls but is not currently used.
…ion calls These parameters are only supported in a testing branch of bitcoind for now.
- makeFundingTx now just selects inputs and change outputs - (new) signFundingTx replaces the funding output script and signs
@t-bast does this look like a reasonable approach to integrating the |
As discussed offline, I don't think we'll want to merge this change for single-funded channel. For simplicity, we should only apply this strategy to dual-funded channels and splicing, which both currently use a similar funding flow (based on the I'm not sure we'll be able to do something similar to what you've done for single-funded channels. I think the design should be that we spawn an |
This is what I've been investigating - one aspect of dual funding that I can't seem to work around is that the initiator doesn't know whether or not to include unconfirmed inputs until after we receive 'accept_channel2' and check the 'requireConfirmedInputs' tlv. Another approach is to create a workflow where we can abort and restart the dual-funded open or splice with the correct inputs locked if we find the local contribution should be increased to avoid a change output. Do you think something like that would be acceptable as a solution? I need to investigate your RBF PR to better understand how that works, but I think we'll need a different approach to handle changing the local contribution for RBF. |
Another idea is adding a tlv to the tx_add_input message that changes the local contribution previously set by open_channel2 (or accept_channel2). If the other side doesn't support that tlv it would cause the flow to break after tx_complete, which is ugly. |
I don't think this is a good idea: it clearly won't be accepted in the BOLTs, and is probably a can of worms to implement correctly.
I don't think this is a big issue: we can use a heuristic to "guess" what our peer will set in Note that this is only an issue when we are sending
This would be very hacky and I don't think it works well in practice: you'd need to be able to correctly pipe that information between the interactive-tx session created by the channel to the peer, which is likely hard to get right. You'd also need to keep inputs locked while you're doing this, but handle all potential error cases to unlock them (otherwise we'd end up with permanently locked utxos which is a serious issue). |
I don't think we should merge this for single-funded channel, let's focus on #2903 only instead. |
This PR selects the inputs for a single funded channel before sending the
open
message to our counter party. This change allows us to create more changeless transaction with theadd_excess_to_recipient_position
andmax_excess
coin selection options added by bitcoind PR #30080.The
makeFundingTx
function now only selects inputs and change outputs, but does not sign the funding tx. The (new)signFundingTx
function replaces the script of the funding output with a script that has the public keys for both parties and signs the funding tx.