You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lightning/src/ln/channel_keys.rs
+29-10Lines changed: 29 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -92,17 +92,26 @@ macro_rules! key_read_write {
92
92
93
93
94
94
95
-
/// Master key used in conjunction with per_commitment_point to generate [`local_delayedpubkey`](https://github.com/lightning/bolts/blob/master/03-transactions.md#key-derivation) for the latest state of a channel.
96
-
/// A watcher can be given a [DelayedPaymentBasepoint] to generate per commitment [DelayedPaymentKey] to create justice transactions.
95
+
/// Base key used in conjunction with a `per_commitment_point` to generate a [`DelayedPaymentKey`].
96
+
///
97
+
/// The delayed payment key is used to pay the commitment state broadcaster their
98
+
/// non-HTLC-encumbered funds after a delay to give their counterparty a chance to punish if the
/// To allow a counterparty to contest a channel state published by a node, Lightning protocol sets delays for some of the outputs, before can be spend.
104
-
/// For example a commitment transaction has to_local output encumbered by a delay, negotiated at the channel establishment flow.
105
-
/// To spend from such output a node has to generate a script using, among others, a local delayed payment key.
105
+
106
+
/// A derived key built from a [`DelayedPaymentBasepoint`] and `per_commitment_point`.
107
+
///
108
+
/// The delayed payment key is used to pay the commitment state broadcaster their
109
+
/// non-HTLC-encumbered funds after a delay. This delay gives their counterparty a chance to
110
+
/// punish and claim all the channel funds if the state broadcasted was previously revoked.
/// for more information on key derivation details.
106
115
#[derive(PartialEq,Eq,Clone,Copy,Debug)]
107
116
pubstructDelayedPaymentKey(pubPublicKey);
108
117
@@ -111,15 +120,25 @@ impl DelayedPaymentKey {
111
120
}
112
121
key_read_write!(DelayedPaymentKey);
113
122
114
-
/// Master key used in conjunction with per_commitment_point to generate [htlcpubkey](https://github.com/lightning/bolts/blob/master/03-transactions.md#key-derivation) for the latest state of a channel.
123
+
/// Base key used in conjunction with a `per_commitment_point` to generate an [`HtlcKey`].
124
+
///
125
+
/// HTLC keys are used to ensure only the recipient of an HTLC can claim it on-chain with the HTLC
126
+
/// preimage and that only the sender of an HTLC can claim it on-chain after it has timed out.
127
+
/// Thus, both channel counterparties' HTLC keys will appears in each HTLC output's script.
115
128
#[derive(PartialEq,Eq,Clone,Copy,Debug,Hash)]
116
129
pubstructHtlcBasepoint(pubPublicKey);
117
130
basepoint_impl!(HtlcBasepoint);
118
131
key_read_write!(HtlcBasepoint);
119
132
120
-
121
-
/// [htlcpubkey](https://github.com/lightning/bolts/blob/master/03-transactions.md#localpubkey-local_htlcpubkey-remote_htlcpubkey-local_delayedpubkey-and-remote_delayedpubkey-derivation) is a child key of an htlc basepoint,
122
-
/// that enables secure routing of payments in onion scheme without a risk of them getting stuck or diverted. It is used to claim the funds in successful or timed out htlc outputs.
133
+
/// A derived key built from a [`HtlcBasepoint`] and `per_commitment_point`.
134
+
///
135
+
/// HTLC keys are used to ensure only the recipient of an HTLC can claim it on-chain with the HTLC
136
+
/// preimage and that only the sender of an HTLC can claim it on-chain after it has timed out.
137
+
/// Thus, both channel counterparties' HTLC keys will appears in each HTLC output's script.
0 commit comments