To truly mitigate pinning against lightning channels, we need to force all commitment transactions and all preimage-claim transactions to use TRUC (see discussions here and here). @t-bast has outlined how we can do this for commitment transactions, but some extra work is needed for preimage claims.
Local commitment preimage claims
We already use presigned HTLC-Success transactions for this case. The only change needed is to presign these transactions as v3.
Remote commitment preimage claims
Currently these claims are not presigned, which means we currently can’t force them to use TRUC. We need to start presigning these claims as v3.
In order to presign these transactions, we need to exchange signatures for them during the commitment update flow.
Adding a half round-trip
@t-bast has suggested that we need to add half a round-trip to the protocol for this, similar to his draft protocol for PTLCs. That would look something like this:
Alice Bob
| commitment_proposed |
|------------------------>|
| commitment_signed |
|<------------------------|
| revoke_and_ack |
|------------------------>|
- When Alice is ready to update her commitment transaction, she sends
commitment_proposedwith signatures for the HTLC-Remote-Success transactions Bob needs to claim HTLCs via preimage from Alice’s new commitment transaction. - Bob sends the usual
commitment_signedmessage with the HTLC-Success, HTLC-Timeout, and commitment signatures Alice needs to spend from her new commitment transaction. - Alice sends
revoke_and_ackto revoke her previous commitment.
Signing flow race
This change increases complexity due to a new race in the signing flow:
- Alice must now initiate the signing flow for her own commitment transaction by sending
commitment_proposedwith whatever HTLCs she has pending on her commitment. - Bob may still be sending updates when he receives Alice’s
commitment_proposed. - Thus when Bob receives Alice’s
commitment_proposedhe doesn’t immediately know which HTLCs need to be included in Alice’s new commitment. Bob must check Alice’s HTLC-Remote-Success signatures against every possible intermediate commitment transaction to figure out which one he should use for hiscommitment_signedmessage.
Minimal alternative
AFAICT, we don’t need to add a half round-trip or introduce a new message at all. We can simply attach HTLC-Remote-Success signatures to the revoke_and_ack message:
Alice Bob
| commitment_signed |
|<------------------------|
| revoke_and_ack |
|------------------------>|
- When Bob is ready to update Alice’s commitment transaction, he sends
commitment_signedas usual. - Alice sends
revoke_and_ackto revoke her previous commitment, while also sending signatures for Bob’s HTLC-Remote-Success transactions.
At no point during this exchange are either Alice’s nor Bob’s funds at risk.
- Before
commitment_signed: Alice and Bob both hold a single valid commitment transaction and all necessary HTLC transactions. - After
commitment_signedbut beforerevoke_and_ack: Alice now holds a second valid commitment transaction, from which Bob cannot claim any HTLCs via preimage. This is fine because the funds locked up in that HTLC are Alice’s, not Bob’s, and Alice can still recover those funds via HTLC-Timeout once the CLTV expires. Since Bob wouldn’t forward the HTLC anyway until he receives Alice’srevoke_and_ackand subsequentcommitment_signed, he has no risk of losing funds. - After
revoke_and_ack: Alice and Bob both hold a single valid commitment transaction and all necessary HTLC transactions. Note that if Alice sends invalid HTLC-Remote-Success signatures, Bob can simply send an error and close the channel.