Skip to content

Commit 29db92f

Browse files
Removed requirement to broadcast an outdated commitment transaction (#942)
If a node has to fail a channel but knows that its latest commitment transaction is outdated it should not be required to send it but rather wait for the peer to unilaterally close the channel. The proposed solution is not so clean because it might produce a deadlock in which two peers assume they have outdated state and send `error` back and forth without actually force closing. Maybe in such a scenario we could create a protocol that mutually closes with split balance? Also replaced the word use with broadcast as it seems more accurate. Co-authored-by: t-bast <[email protected]>
1 parent ed7b5f5 commit 29db92f

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

02-peer-protocol.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,7 @@ A node:
14051405
`your_last_per_commitment_secret` is correct for that
14061406
`next_revocation_number` minus 1:
14071407
- MUST NOT broadcast its commitment transaction.
1408-
- SHOULD fail the channel.
1408+
- SHOULD send an `error` to request the peer to fail the channel.
14091409
- otherwise:
14101410
- if `your_last_per_commitment_secret` does not match the expected values:
14111411
- SHOULD send an `error` and fail the channel.
@@ -1414,7 +1414,7 @@ A node:
14141414
`your_last_per_commitment_secret` is correct for that
14151415
`next_revocation_number` minus 1:
14161416
- MUST NOT broadcast its commitment transaction.
1417-
- SHOULD fail the channel.
1417+
- SHOULD send an `error` to request the peer to fail the channel.
14181418
- SHOULD store `my_current_per_commitment_point` to retrieve funds
14191419
should the sending node broadcast its commitment transaction on-chain.
14201420
- otherwise (`your_last_per_commitment_secret` or `my_current_per_commitment_point`
@@ -1490,18 +1490,19 @@ Similarly, for the fundee's `funding_signed` message: it's better to
14901490
remember a channel that never opens (and times out) than to let the
14911491
funder open it while the fundee has forgotten it.
14921492

1493-
`option_data_loss_protect` was added to allow a node, which has somehow fallen behind
1494-
(e.g. has been restored from old backup), to detect that it's fallen-behind. A fallen-behind
1495-
node must know it cannot broadcast its current commitment transaction — which would lead to
1496-
total loss of funds — as the remote node can prove it knows the
1497-
revocation preimage. The error returned by the fallen-behind node
1498-
(or simply the invalid numbers in the `channel_reestablish` it has
1499-
sent) should make the other node drop its current commitment
1500-
transaction to the chain. This will, at least, allow the fallen-behind node to recover
1501-
non-HTLC funds, if the `my_current_per_commitment_point`
1502-
is valid. However, this also means the fallen-behind node has revealed this
1503-
fact (though not provably: it could be lying), and the other node could use this to
1504-
broadcast a previous state.
1493+
`option_data_loss_protect` was added to allow a node, which has somehow fallen
1494+
behind (e.g. has been restored from old backup), to detect that it has fallen
1495+
behind. A fallen-behind node must know it cannot broadcast its current
1496+
commitment transaction — which would lead to total loss of funds — as the
1497+
remote node can prove it knows the revocation preimage. The `error` returned by
1498+
the fallen-behind node should make the other node drop its current commitment
1499+
transaction to the chain. The other node should wait for that `error` to give
1500+
the fallen-behind node an opportunity to fix its state first (e.g by restarting
1501+
with a different backup). If the fallen-behind node doesn't have the latest
1502+
backup, this will, at least, allow it to recover non-HTLC funds, if the
1503+
`my_current_per_commitment_point` is valid. However, this also means the
1504+
fallen-behind node has revealed this fact (though not provably: it could be lying),
1505+
and the other node could use this to broadcast a previous state.
15051506

15061507
`option_static_remotekey` removes the changing `to_remote` key,
15071508
so the `my_current_per_commitment_point` is unnecessary and thus

05-onchain.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,15 @@ A node:
143143
sufficient fee:
144144
- SHOULD use this fee to perform a *mutual close*.
145145
- otherwise:
146-
- MUST use the *last commitment transaction*, for which it has a
147-
signature, to perform a *unilateral close*.
148-
- MUST spend any `to_local_anchor` output, providing sufficient fees as incentive to include the commitment transaction in a block
149-
Special care must be taken when spending to a third-party, because this re-introduces the vulnerability that was
150-
addressed by adding the CSV delay to the non-anchor outputs.
151-
- SHOULD use [replace-by-fee](https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki) or other mechanism on the spending transaction if it proves insufficient for timely inclusion in a block.
146+
- if the node knows or assumes its channel state is outdated:
147+
- MUST NOT broadcast its *last commitment transaction*.
148+
- otherwise:
149+
- MUST broadcast the *last commitment transaction*, for which it has a
150+
signature, to perform a *unilateral close*.
151+
- MUST spend any `to_local_anchor` output, providing sufficient fees as incentive to include the commitment transaction in a block.
152+
Special care must be taken when spending to a third-party, because this re-introduces the vulnerability that was
153+
addressed by adding the CSV delay to the non-anchor outputs.
154+
- SHOULD use [replace-by-fee](https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki) or other mechanism on the spending transaction if it proves insufficient for timely inclusion in a block.
152155

153156
## Rationale
154157

0 commit comments

Comments
 (0)