How would you transmit a commitment transaction from a lightning network channel instead of closing the channel? I am working on implementing a watchtower and I first need to simulate a double spend attempt. When I close a channel with $ lncli closechannel, both nodes have the bitcoin available and neither has to wait for the time lock. Is there a command to get the node to submit a unilateral close commitment transaction where one of them has to wait for the time lock?
LND has an option to close a channel unilaterally as following command,
$lncli closechannel --force funding_txid output_index
I have transmitted a commitment transaction to answer this question. It might be another useful resource of your work.
Generally it is preferable to collaboratively close a channel as it is faster for both sides and saves onchain fees and space. As far as I know implementations do not provide an api to the close command by which you can enforce a certain type of close. In order to achieve what you want you have 2 options:
- You Patch your lightning node to provide that api yourself
- You run two lightning nodes with a channel between them. Then you turn off one node and run the close command on the other. As the first node is not peered the nodes can't close collaboratively so there will happen a force close.