Skip to content

Commit 20e1b78

Browse files
f Matt's feedback, mostly concerning the fact that we don't 'construct' per-commitment-points
1 parent 4351d8d commit 20e1b78

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

lightning/src/ln/channel.rs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,20 @@ enum InboundHTLCRemovalReason {
5454

5555
enum InboundHTLCState {
5656
/// Offered by remote, to be included in next local commitment tx. I.e., the remote sent an
57-
// update_add_htlc message for this HTLC.
57+
/// update_add_htlc message for this HTLC.
5858
RemoteAnnounced(PendingHTLCStatus),
59-
/// Included in a received commitment_signed message (implying we've revoke_and_ack'd it), but
60-
/// the remote hasn't yet revoked their previous state (see the example below). We have not yet
61-
/// included this HTLC in a commitment_signed message because we are waiting on the remote's
62-
/// aforementioned state revocation. The reason we need this remote RAA (revoke_and_ack) is
63-
/// because every time we create a new "state", i.e. every time we create our next
64-
/// per_commitment_point (see [BOLT #2]), we consume a prior revocation point (aka the
65-
/// per_commitment_secret in the revoke_and_ack message (see BOLT #2)).
59+
/// Included in a received commitment_signed message (implying we've
60+
/// revoke_and_ack'd it), but the remote hasn't yet revoked their previous
61+
/// state (see the example below). We have not yet included this HTLC in a
62+
/// commitment_signed message because we are waiting on the remote's
63+
/// aforementioned state revocation. One reason this missing remote RAA
64+
/// (revoke_and_ack) blocks us from constructing a commitment_signed message
65+
/// is because every time we create a new "state", i.e. every time we sign a
66+
/// new commitment tx (see [BOLT #2]), we need a new per_commitment_point,
67+
/// which are provided one-at-a-time in each RAA. E.g., the last RAA they
68+
/// sent provided the per_commitment_point for our current commitment tx.
69+
/// The other reason we should not send a commitment_signed without their RAA
70+
/// is because their RAA serves to ACK our previous commitment_signed.
6671
///
6772
/// Here's an example of how an HTLC could come to be in this state:
6873
/// remote --> update_add_htlc(prev_htlc) --> local
@@ -72,10 +77,11 @@ enum InboundHTLCState {
7277
/// [note that here, the remote does not respond with a RAA]
7378
/// remote --> update_add_htlc(this_htlc) --> local
7479
/// remote --> commitment_signed(prev_htlc, this_htlc) --> local
75-
/// Now `this_htlc` will be assigned this state. It's unable to be officially accepted, i.e.
76-
/// included in a commitment_signed, because we're missing the RAA that would let us construct
77-
/// our next per_commitment_point, which is used to derive commitment keys, which are used
78-
/// to construct the signatures in a commitment_signed message.
80+
/// Now `this_htlc` will be assigned this state. It's unable to be officially
81+
/// accepted, i.e. included in a commitment_signed, because we're missing the
82+
/// RAA that provides our next per_commitment_point. The per_commitment_point
83+
/// is used to derive commitment keys, which are used to construct the
84+
/// signatures in a commitment_signed message.
7985
/// Implies AwaitingRemoteRevoke.
8086
/// [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
8187
AwaitingRemoteRevokeToAnnounce(PendingHTLCStatus),

0 commit comments

Comments
 (0)