Skip to content

Commit 28a95e0

Browse files
committed
Separate commitment_signed batches from interactive tx commitment_signed
Clarifying the logic for `commitment_signed` batches are different and separate from individual `commitment_signed` messages used during interactive transaction protocol reestablishing. This creates a clean separation from when `next_commitment_number` is being used to resend an individual `commitment_signed` message and when it is being used to resend a `commitment_signed` batch. Without this change implementors don’t have clarity about whether a decremented `next_commitment_number` is meant to send an individual `commitment_signed` message, ``commitment_signed` batch, or both.
1 parent 02da8e4 commit 28a95e0

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

02-peer-protocol.md

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3296,8 +3296,6 @@ A node:
32963296
message before sending any other messages for that channel.
32973297

32983298
The sending node:
3299-
- MUST set `next_commitment_number` to the commitment number of the
3300-
next `commitment_signed` it expects to receive.
33013299
- MUST set `next_revocation_number` to the commitment number of the
33023300
next `revoke_and_ack` message it expects to receive.
33033301
- MUST set `my_current_per_commitment_point` to a valid point.
@@ -3312,6 +3310,8 @@ The sending node:
33123310
- MUST set `next_commitment_number` to the commitment number of the `commitment_signed` it sent.
33133311
- otherwise:
33143312
- MUST NOT set `next_funding_txid`.
3313+
- MUST set `next_commitment_number` to the commitment number of the
3314+
next `commitment_signed` batch it expects to receive.
33153315
- if `option_splice` was negotiated:
33163316
- MUST set `your_last_funding_locked` to the txid of the last `splice_locked` it received.
33173317
- if it never received `splice_locked` for any transaction, but it received `channel_ready`:
@@ -3347,25 +3347,34 @@ A node:
33473347
a different `short_channel_id` `alias` field.
33483348
- upon reconnection:
33493349
- MUST ignore any redundant `channel_ready` it receives.
3350-
- if `next_commitment_number` is equal to the commitment number of
3351-
the last `commitment_signed` message the receiving node has sent:
3352-
- MUST reuse the same commitment number for its next `commitment_signed`.
3350+
- if it has set `next_funding_txid`:
3351+
- if `next_commitment_number` matches the last `commitment_signed` message
3352+
that was already sent for the latest interactive transaction construction:
3353+
- MUST retransmit `commitment_signed` for the latest interactive
3354+
transaction construction.
3355+
- MUST use `next_commitment_number` + 1 for its next `commitment_signed`
3356+
batch.
33533357
- otherwise:
3354-
- if `next_commitment_number` is not 1 greater than the
3355-
commitment number of the last `commitment_signed` message the receiving
3356-
node has sent:
3357-
- SHOULD send an `error` and fail the channel.
3358-
- if it has not sent `commitment_signed`, AND `next_commitment_number`
3359-
is not equal to 1:
3360-
- SHOULD send an `error` and fail the channel.
3358+
- if `next_commitment_number` is equal to the commitment number of
3359+
the last `commitment_signed` message batch the receiving node has sent:
3360+
- MUST reuse the same commitment number for its next `commitment_signed`
3361+
batch.
3362+
- otherwise:
3363+
- if `next_commitment_number` is not 1 greater than the
3364+
commitment number of the last `commitment_signed` message batch the
3365+
receiving node has sent:
3366+
- SHOULD send an `error` and fail the channel.
3367+
- if it has not sent the `commitment_signed` batch, AND
3368+
`next_commitment_number` is not equal to 1:
3369+
- SHOULD send an `error` and fail the channel.
33613370
- if `next_revocation_number` is equal to the commitment number of
33623371
the last `revoke_and_ack` the receiving node sent, AND the receiving node
33633372
hasn't already received a `closing_signed`:
33643373
- MUST re-send the `revoke_and_ack`.
3365-
- if it has previously sent a `commitment_signed` that needs to be
3374+
- if it has previously sent a `commitment_signed` bacth that needs to be
33663375
retransmitted:
3367-
- MUST retransmit `revoke_and_ack` and `commitment_signed` in the same
3368-
relative order as initially transmitted.
3376+
- MUST retransmit `revoke_and_ack` and `commitment_signed` batch in the
3377+
same relative order as initially transmitted.
33693378
- otherwise:
33703379
- if `next_revocation_number` is not equal to 1 greater than the
33713380
commitment number of the last `revoke_and_ack` the receiving node has sent:
@@ -3465,7 +3474,7 @@ by the remote node.
34653474
Note that the `next_commitment_number` starts at 1, since
34663475
commitment number 0 is created during opening.
34673476
`next_revocation_number` will be 0 until the
3468-
`commitment_signed` for commitment number 1 is send and then
3477+
`commitment_signed` batch for commitment number 1 is send and then
34693478
the revocation for commitment number 0 is received.
34703479

34713480
`channel_ready` is implicitly acknowledged by the start of normal

0 commit comments

Comments
 (0)