lnd icon indicating copy to clipboard operation
lnd copied to clipboard

[feature]: Return structured information when BatchOpenChannel fails

Open sidiropo opened this issue 1 year ago • 3 comments
trafficstars

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

sidiropo avatar Aug 19 '24 12:08 sidiropo

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.

ziggie1984 avatar Aug 20 '24 11:08 ziggie1984

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

ziggie1984 avatar Aug 20 '24 11:08 ziggie1984

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

guggero avatar Aug 20 '24 12:08 guggero

Converting this issue to a discussion. Issue can be opened when the development is planned.

saubyk avatar Sep 24 '25 00:09 saubyk