segmentation fault - fundPsbt
I would like to fund a 0conf channel running for the Blocktank LSP. I didn't see openChannel supporting it so I tried the manual route. For that, I need to call fundPsbt. Unfortunately, my app terminates with a segmentation fault every time I call the method. Do you have any suggestion to get around that?
Example:
import * as ln from 'lightning';
const result = await ln.fundPsbt({ // Terminates with segmentation fault.
lnd: node.rpc,
outputs: [{
address: 'bcrt1qz3trhgd4p95l74xda4f57npmrd2p64he4ucjqky77ztw6zulj8aq6nrpds',
tokens: 100000
}]
});
console.log(result)
Logs: No new lnd logs appear when I call this.
- lightning lib version: 9.8.1
- node version: v18.12.1
- LND version: v0.16.4-beta
- Chain: regtest on Polar
No idea why but changing import('ecpair') to require('ecpair') in ln_methods/onchain/fund_pbst.js fixes the problem for me 🤷♂️ Maybe somebody can reproduce this issue + solution.
for the original issue, you can use trusted funding channels, here is an example integration test: https://github.com/alexbosworth/ln-service/blob/master/test/integration/test_trusted_funding.js#L189
for the segmentation fault that is odd, do you have any error strings I could look at? Did you try nodejs 16 or 20?
Maybe this is a caching issue? I saw this issue that might be related https://bugs.chromium.org/p/v8/issues/detail?id=10284 so maybe clear npm build cache etc?
Turns out this is a Jest ESM issue. ESM support in Jest (and NodeJs 18 partially?) is still not perfect and import (a ESM feature) broke the code. require (CommonJS feature) worked. If I run the code without Jest, it works. So I am not sure if this is a issue with the library or Jest. I will try to work around it.
for the original issue, you can use trusted funding channels, here is an example integration test: https://github.com/alexbosworth/ln-service/blob/master/test/integration/test_trusted_funding.js#L189
Nice thx. Is it possible to create a fee bump able anchor channel with this method?
On the other hand, I looked a bit deeper into the library. If you want, I can create a PR that adds the zero_conf and commitment_type parameters to the openChannel method. Let me know what you think
The only type of trusted funding channels that LND supports at the moment is anchor channels