Thank you, Ken. I have a follow up question as well. Context: I’m playing around with some failure scenarios in LND. Say Alice is paying Bob, before Bob is able to send the fulfillment (which includes the HTLC preimage), Alice’s node dies and becomes unreachable.
Bob has already received the commitment for the updated balance and already has the preimage, so he force closes the channel. My understanding is that he will submit the updated commitment to the blockchain as well as the channel closing transaction (after the CSV timeout) which spends his to_local and the HTLC output. Here is my problem. After using `lncli closechannel --force ...` , I only see the commitment transaction in the mempool, not the subsequent HTLC/to_local spend. How can I generate the transaction that spends the to_local and HTLC output? If there's a way to generate it with lnd, that would be ideal. Thanks in advance! Ben ________________________________ From: Ken Sedgwick <ksedg...@bonsai.com> Sent: Sunday, April 30, 2023 14:30 To: Benjamin Weintraub <weintrau...@northeastern.edu> Cc: Lightning-dev@lists.linuxfoundation.org <lightning-dev@lists.linuxfoundation.org> Subject: Re: [Lightning-dev] Spending `to_local` output of commitment Ben, The necessary witness is described here: https://github.com/lightning/bolts/blob/master/03-transactions.md#to_local-output Regards, Ken On Sat, Apr 29, 2023 at 7:57 PM Benjamin Weintraub via Lightning-dev <lightning-dev@lists.linuxfoundation.org<mailto:lightning-dev@lists.linuxfoundation.org>> wrote: Hi all, I have a question about commitments. If a peer force closes a channel by sending a commitment to the blockchain, what kind of witness script is needed to redeem the `to_local` funds? (assuming the `to_self_delay` has elapsed.) It seems that the transaction described here is for cooperative closures: https://github.com/lightning/bolts/blob/c74a3bbcf890799d343c62cb05fcbcdc952a1cf3/03-transactions.md#closing-transaction. But for force closures, I would think that the txin would need to be the `to_local` txout of the commitment. Concretely, I have commited the following transaction on a local simnet bitcoin blockchain and mined 500 blocks on top of it. I want to spend vout[2], how can I generate such a transaction? { "hash": "47d15337bb3c29c7c2881dd7cd912604b401ed221c66ea6f781b456d4983d451", "size": 444, "vsize": 279, "weight": 1113, "version": 2, "locktime": 551351761, "vin": [ { "txid": "0248025b9447df8267d02d14c34ab9b269f52cd827132c70159a55cbf27ab3c1", "vout": 0, "scriptSig": { "asm": "", "hex": "" }, "txinwitness": [ "", "3045022100d3f52ca04d6a71587c29592931e542b16a47f3e9e577f1869b416547d00c62dd0220485da35ad31ff71b4263b1a25f0ba9f35990e1c8d5ac848365bbd588c3ce83d701", "3044022057fc3878e17a865c12d57b7885ed48f0d6122bd9e00511c8eac150180d1508d502205fd1d0674a41b3c0118d0b6c19b1c77d35fc95bb89f929da6478f22e94dbf5ce01", "5221038acdafe305edd06e91706ee687a091be306f0f29bcbda52dadde084bbaa36c902103d8fd53b9b43638c2255e1abd6f134a0232d2fba65527252c4eb81f926ddf50ad52ae" ], "sequence": 2161061453 } ], "vout": [ { "value": 0.0000033, "n": 0, "scriptPubKey": { "asm": "0 45ec86244376d47000ca6592783ba26f6b2ae619a24c8f5fad249b8c716955d6", "hex": "002045ec86244376d47000ca6592783ba26f6b2ae619a24c8f5fad249b8c716955d6", "reqSigs": 1, "type": "witness_v0_scripthash", "addresses": [ "sb1qghkgvfzrwm28qqx2vkf8swazda4j4ese5fxg7hadyjdccutf2htqysq3qz" ] } }, { "value": 0.0000033, "n": 1, "scriptPubKey": { "asm": "0 502a17644b334482d0a3f589d9861af6e2105a9b7afd3f5c258efc98bb6aeeed", "hex": "0020502a17644b334482d0a3f589d9861af6e2105a9b7afd3f5c258efc98bb6aeeed", "reqSigs": 1, "type": "witness_v0_scripthash", "addresses": [ "sb1q2q4pweztxdzg959r7kyanps67m3pqk5m0t7n7hp93m7f3wm2amksa0fysc" ] } }, { "value": 0.0002, "n": 2, "scriptPubKey": { "asm": "0 045553fc789494f16eff4cfa221d0294e140fb79772efeb7d8397d0ac1c4cf85", "hex": "0020045553fc789494f16eff4cfa221d0294e140fb79772efeb7d8397d0ac1c4cf85", "reqSigs": 1, "type": "witness_v0_scripthash", "addresses": [ "sb1qq3248lrcjj20zmhlfnazy8gzjns5p7mewuh0ad7c897s4swye7zsyrm5pc" ] } }, { "value": 0.009761, "n": 3, "scriptPubKey": { "asm": "0 2d51ca420d0b6ab56c97ca2631d7304c9ad9025252ea71f3af8f97361679042e", "hex": "00202d51ca420d0b6ab56c97ca2631d7304c9ad9025252ea71f3af8f97361679042e", "reqSigs": 1, "type": "witness_v0_scripthash", "addresses": [ "sb1q94gu5ssdpd4t2myhegnrr4esfjddjqjj2t48rua037tnv9neqshqm4z7yr" ] } } ], "blockhash": "0fa78bc7e9f6e0a60be71bb5fb2eaaf42a97895bb057f09d7cbb2c49120fa61d", "confirmations": 500, "time": 1682451410, "blocktime": 1682451410 } Thanks in advance, Ben _______________________________________________ Lightning-dev mailing list Lightning-dev@lists.linuxfoundation.org<mailto:Lightning-dev@lists.linuxfoundation.org> https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev -- Ken Sedgwick Bonsai Software, Inc. http://www.bonsai.com/ken/ (510) 269-7334 k...@bonsai.com<mailto:k...@bonsai.com> Public Key: http://www.bonsai.com/ken/ken.asc GPG Fingerprint: 4695 E5B8 F781 BF85 4326 9639 BBFC E515 8602 5550
_______________________________________________ Lightning-dev mailing list Lightning-dev@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev