Closed niteshbalusu11 closed 2 years ago
what's the error?
The core lightning logs say connected to web socket and then this line just times out. Does not go beyond it.
await ln.connect_and_init('033292f0c69eea1b98243e0d11ea5891b828d6af75e73bc1392829f38116738880', 'localhost:9989');
On Wed, Oct 05, 2022 at 03:36:45AM -0700, Nitesh Balusu wrote:
The core lightning logs say connected to web socket and then this line just times out. Does not go beyond it.
await ln.connect_and_init('033292f0c69eea1b98243e0d11ea5891b828d6af75e73bc1392829f38116738880', 'localhost:9989');
you don't need to be connecting to the websocket port if you're using npm. just connect to the regular lighting socket port.
you don't need to be connecting to the websocket port if you're using npm. just connect to the regular lighting socket port.
I tried that. Now it just exits when trying to connect, it's actually going into the catch statement but the error is undefined so I don't know the reason for failure is as well.
It fails at this line await ln.connect_and_init('03df9bc82421a635b0800bda0f2594f6503948ff5e63f8d2cffce22d247e1b997d', 'localhost:9735');
import LNSocket from 'lnsocket';
async function go() {
try {
const ln = await LNSocket();
ln.genkey();
await ln.connect_and_init('03df9bc82421a635b0800bda0f2594f6503948ff5e63f8d2cffce22d247e1b997d', 'localhost:9735');
const rune = 'bIVwSqadLdtskll4CdRprHsSe2d9Og5H_0VGa0r8ahA9MQ==';
const res = await ln.rpc({ method: 'getinfo', rune });
ln.destroy();
console.log(res);
return res;
} catch (err) {
console.log('err', err);
}
}
go();
On Tue, Oct 11, 2022 at 03:20:58PM -0700, Nitesh Balusu wrote:
you don't need to be connecting to the websocket port if you're using npm. just connect to the regular lighting socket port.
I tried that. Now it just exits when trying to connect, it's actually going into the catch statement but the error is undefined so I don't know the reason for failure is as well.
do you see anything in your cln logs?
Nothing really, if I use the websocket port instead of 9735, the logs will say connected to websocket from IP:PORT and but the connection just hangs at await ln.connect_and_init()
Just to be clear of the setup I am trying, it's on polar regtest on my own machine and the pubkey I am passing to connect_and_init is my own pubkey, just remotely accessing my node.
After debugging, I see it stops here.
https://github.com/jb55/lnsocket/blob/master/dist/node/lnsocket.js#L198
self.queue is an empty array and that setInterval never clears and eventually the default websocket timeout happens and it fails.
Finally figured it out, it's a bug in Polar itself, it does not announce 9735 port by default. sigh! It does for LND and Eclair but it was missed for core-lightning.
it would be good to have better errors here though!
Hey! Is this the right way to use with node.js? I can't seem to get it to work.