lightninglabs / lnc-web

Lightning Node Connect npm module for web
https://docs.lightning.engineering/lightning-network-tools/lightning-terminal/lnc-npm
48 stars 17 forks source link

Make connect timeout configurable (or something else) #111

Open huumn opened 7 months ago

huumn commented 7 months ago

The package currently waits a hardcoded second for the connection to succeed and when that times out it leaves the connection in an undetermined state. Increasing the timeout could give someone more certainty the connection actually failed.

This might be legacy code considering usage of WithBlock in lightning-node-connect's grpc.DialOptions is listed as a deprecated antipattern.

Anyway, it's hard to determine, as a consumer of connect, how to recover when the function reports a failure.

https://github.com/lightninglabs/lnc-web/blob/f65cf92b50b3d580072d76a40eff763a97d7a67b/lib/lnc.ts#L226-L250

lnbc1QWFyb24 commented 5 months ago

Yes I second this, would love to be able to configure the timeout to be a bit longer. It seems to be 50/50 chance of successful connection at times as it times out just before successfully connecting.