lnd
lnd copied to clipboard
[feature]: Return structured information when BatchOpenChannel fails
Is your feature request related to a problem? Please describe.
When BatchOpenChannel fails, it returns an unstructured error string. This makes it difficult to detect which peer caused the failure. One could try parsing the string, but there is no standard format.
Describe the solution you'd like
It would be useful if BatchOpenChannel returned a structure describing which peers failed exactly.
Describe alternatives you've considered
Additional context
So the batch opening can fail not only because of the interplay between a specific peer, I decided to provide a simple fix to add the particular peer in the error as soon as we can be sure the opening process failed due to this peer.
Open to add RPC structured errors as well, but IMO it's overkill.
This is how it looks right now when we are sure the channel failed because of a peer interaction:
[lncli] rpc error: code = Unknown desc = batch funding failed: error batch opening channel, initial negotiation failed: batch channel error while interacting with peer(02a69649fea233e7f6fe5d6c7e218341884267b6e8675a39fecb91dc8ee3ba8584): remote canceled funding, possibly timed out: received funding error from 02a69649fea233e7f6fe5d6c7e218341884267b6e8675a39fecb91dc8ee3ba8584: chan_id=efca0613bb9482b071764fd2f77e1e60c4a6a153c1a9bc08428e1055a8d3f2a3, err=channel rejected
There have been a couple of attempts at structured errors, but it's not easy to generalize them in a nice and consistent manner. See discussions in
- https://github.com/lightningnetwork/lnd/issues/6861
- https://github.com/lightningnetwork/lnd/issues/5411
- https://github.com/lightningnetwork/lnd/issues/4707
- https://github.com/lightningnetwork/lnd/pull/5633
- https://github.com/lightningnetwork/lnd/pull/5436
Converting this issue to a discussion. Issue can be opened when the development is planned.