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

Add argument to OpenChannel rpc to input UTXOs #6955

Closed
3 tasks done
saubyk opened this issue Sep 29, 2022 · 6 comments · Fixed by #7516
Closed
3 tasks done

Add argument to OpenChannel rpc to input UTXOs #6955

saubyk opened this issue Sep 29, 2022 · 6 comments · Fixed by #7516
Assignees
Labels
api channel management The management of the nodes channels coin selection rpc Related to the RPC interface
Milestone

Comments

@saubyk
Copy link
Collaborator

saubyk commented Sep 29, 2022

To simplify app development for coin selection on channel opens an additional argument should be added to the OpenChannel rpc. This argument should take an array of UTXOs which the application (user) passes. The processing logic should also include fee estimation, which enables complete UTXO consumption with no change output being generated.
Two scenarios to explain the requirement.

Scenario 1: User selects coins to use and specifies the amount to open the channel with. This can result in a change output being generated depending upon the amount in coins and fee rate chosen (essentially same as current functionality but with selected UTXOs)
The OpenChannel rpc will be called with:

  • utxo argument
  • amount
  • fee rate (default or chosen by the user)

Scenario 2: User selects coins to use and indicates to use them whole. This should result in no change output.
The OpenChannel rpc will be called with:

  • utxo argument
  • fundmax flag as true
  • fee rate (default or chosen by the user)

The scope of change includes:

fundmax flag is introduced with the below pr:
#6903
Related issue:
#6949

@saubyk saubyk added channel management The management of the nodes channels coin selection api rpc Related to the RPC interface labels Sep 29, 2022
@hieblmi
Copy link
Collaborator

hieblmi commented Sep 29, 2022

@saubyk As mentioned in #6949 I'd like to take a shot at this issue.

One thought regarding Scenario 2.
Wouldn't it make sense to omit the fundmax flag and take the missing local_amt as indicator that the entirety of the --utxos is going towards the channel funding? This would also tie in with the current user experience when only specifying local_amt. We'd have:

  • lncli openchannel --node_key=xxx --local_amt yyy -> spends entirety of local_amt
  • lncli openchannel --node_key=xxx --utxos utxo1,utxo2,utxo3 -> implies to spend entirety of the 3 utxos
  • lncli openchannel --node_key=xxx --utxos utxo1,utxo2,utxo3 --local_amt yyy -> spends yyy sats from the 3 utxos

@saubyk
Copy link
Collaborator Author

saubyk commented Sep 29, 2022

@hieblmi when it comes to providing options, my preference is always to be explicit rather than implicit. But I would let someone more qualified than I am on this, to chime in
cc: @guggero @Roasbeef

@saubyk saubyk added this to the v0.17.0 milestone Sep 29, 2022
@guggero
Copy link
Collaborator

guggero commented Sep 30, 2022

I agree with making things as explicit as possible. Otherwise it might happen that I forget --local_amt and my node just creates the largest channel it can. We could discuss using the value of -1 for --local_amt instead of an additional flag (at least on the command line, would probably still use the flag on the RPC), but not sure if that makes things any more clear.

@hieblmi
Copy link
Collaborator

hieblmi commented Apr 3, 2023

I am working on tests for edge-cases in the coin selection and wanted to get your thoughts on the following scenario.

Suppose we have two coins in our wallet, say 100_000 and 8_000 sats. If we open an anchor channel and select the utxo with100_000 sats and specify a local amount of 100_000 - miner_fee - 2_000 then I would expect the opening to succeed since we keep 10_000 in total in our wallet to cover for the anchor reserve.
Do you agree that this is the behavior that we want?

@guggero
Copy link
Collaborator

guggero commented Apr 11, 2023

Do you agree that this is the behavior that we want?

Sounds like the expected behavior, yes. So the check for the anchor reserve should take into account the full wallet balance and not only the selected UTXOs.

@hieblmi
Copy link
Collaborator

hieblmi commented Apr 11, 2023

Ok, it sounds obvious. I was asking this in the context of the fundmax flavor of this flow already taking care of the reserve during coin selection whereas the local-amt flow has to be adjusted to account for the reserve. I will note this in the related PR #7516.

@saubyk saubyk removed this from lnd v0.17 Jun 15, 2023
@saubyk saubyk modified the milestones: v0.17.0, v0.17.1 Jun 15, 2023
@saubyk saubyk modified the milestones: v0.17.1, v0.17.0 Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api channel management The management of the nodes channels coin selection rpc Related to the RPC interface
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants