Adds `fundmax` flag to `openchannel` (funding)

Host: bjarnemagnussen  -  PR author: bjarnemagnussen


  • This PR has been open for a long time and underwent numerous changes
  • Coin Selection is the procedure that selects UTXOs (“coins”) from the wallet


  • What in your own words would you expect that a fundmax flag should do in the call to OpenChannel?
  • Why seems adding a fundmax flag to the OpenChannel command a bit more complex compared to e.g. the sweepall flag of the SendCoins command?
  • Can you identify independent code changes to LND that required additional attention in this PR (list some of the requirements that has to be correctly handled)?
  • What is a concurrency issue that all funding logic must consider? How is that generally handled in the LND codebase?
  • What checks are in place to prevent incorrect funding of a channel (can be already existing ones or checks introduced with this PR)?
  • How is PR#4588 related to this PR?