funding: fund channel with selected utxos (funding)

Host: hieblmi  -  PR author: hieblmi


  • The PR description itself should provide a good intro.
  • This PR is utilizing the fundmax flag introduced with It might be helpful to get a rough idea of how it works - especially CoinSelectUpToAmount.
  • The integration test itest/lnd_channel_funding_utxo_selection_test.go provides a good overview of the proposed behavior introduced by this PR.


  • Did you review the PR and, if so, what’s your overall verdict? (ACK, NACK, concept ACK, unknown, mega-NACK)
  • What use cases can you think of where it might be useful to only take a subset of coins in our wallet into account for funding a channel?
  • How could the lncli openchannel --local_amt flow mix coins that the user potentially would want to keep separate? Hint: Checkout chanfunding/coin_select.go - func CoinSelect().
  • Is there another way of selecting specific UTXOs to fund a channel? If so, what are pros and cons you can think of for this alternative?
  • Since we are manually selecting coins - why are we still calling

    • CoinSelect in case we lncli openchannel --local_amt ?
    • CoinSelectUpToAmount in case we lncli openchannel --fundmax ?
  • Why is reserve set to 0 here? (Note, this is the fundmax flow of the PR)
    • Can you think of an edge case that isn’t considered here? What if sumAll-sumManual < reserve?
    • Do you see a problem here in the case of the local_amt flow? This flow is handled in the default case of the switch statement, here