ElementsProject / ElementsProject/lightning
Anchor output support in Elements mode
- Dominant language
- C
- Stars
- 3.1k
- Forks
- 1k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 13
Description
### Issue and Steps to Reproduce
Unfortunately the issue is not easy to reproduce but I will describe it as well as I can:
I am working on adding Elements/Liquid support to the [VLS signer](https://gitlab.com/lightning-signer/validating-lightning-signer). VLS has an integration test repo [here](https://gitlab.com/lightning-signer/vls-hsmd) where they test their signer replacing the HSM of CLN.
In my testing of my Elements support in VLS I ran into the following problem:
With the `tests/test_pay.py::test_pay` pyln test when running the CLN-VLS integration test environment under the `liquid-regtest` network VLS is failing when handling the `SignRemoteCommitmentTx` operation because the Elements flavoured PSBT (strictly speaking a PSET using the PSBTv2 format) is received as part of that requrest the outputs do not have the required `witness_scripts`. It looks like they are plain P2WSH outputs rather than Segwit outputs with an Anchor output script. VLS asserts that every output should have a witness script and so crashed.
In CLN I tracked the issue to the following spot:
This transaction and PSBT is constructed in CLN in the `struct bitcoin_tx *initial_commit_tx(...)` method which is being called from `openingd.c::funder_finalize_channel_setup(...)`
So when that method comes to adding outputs both `regtest` and `liquid-regtest` cases don't add a to_local output.
They both add a `to_remote` outputs BUT in the `regtest` mode the `option_anchors_zero_fee_htlc_tx` flag is set so the witness script is added to the output. In the `liquid-regtest` mode that flag is NOT set and so the witness script is not added.
finally in `regtest` mode the `option_anchors_zero_fee_htlc_tx` flag being set means that an anchor_output is added to the transaction but it is not included `liquid-regtest` mode.
### `getinfo` output
The VLS integration test environment is using this branch of CLN
[https://github.com/lightning-signer/c-lightning/tree/2024-05-remote-hsmd-cln-v24.05](https://github.com/lightning-signer/c-lightning/tree/2024-05-remote-hsmd-cln-v24.05)
Received response for getinfo call: {'jsonrpc': '2.0', 'id': 'pytest:getinfo#2', 'result': {'id': '0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518', 'alias': 'JUNIORBEAM-smd-cln-v24.05-modded', 'color': '0266e4', 'num_peers': 0, 'num_pending_channels': 0, 'num_active_channels': 0, 'num_inactive_channels': 0, 'address': [], 'binding': [{'type': 'ipv4', 'address': '127.0.0.1', 'port': 45621}], 'version': 'remote-hsmd-cln-v24.05-modded', 'blockheight': 101, 'network': 'regtest', 'fees_collected_msat': 0, 'lightning-dir': '/root/vls-hsmd/TEST-20241105-135945/ltests-eesvjwt2/test_pay_1/lightning-1/regtest', 'our_features': {'init': '08a0000a8a59a1', 'node': '88a0000a8a59a1', 'channel': '', 'invoice': '02000002024100'}}}
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.