@@ -47,9 +47,9 @@ use ln::msgs::DecodeError;
47
47
/// that txid/index, and any keys or other information required to sign.
48
48
#[ derive( Clone , Debug , PartialEq ) ]
49
49
pub enum SpendableOutputDescriptor {
50
- /// An output to a script which was provided via KeysInterface, thus you should already know
51
- /// how to spend it. No keys are provided as rust-lightning was never given any keys - only the
52
- /// script_pubkey as it appears in the output .
50
+ /// An output to a script which was provided via KeysInterface directly, either from
51
+ /// `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to
52
+ /// spend it. No keys are provided as rust-lightning was never given any key .
53
53
/// These may include outputs from a transaction punishing our counterparty or claiming an HTLC
54
54
/// on-chain using the payment preimage or after it has timed out.
55
55
StaticOutput {
@@ -98,11 +98,14 @@ pub enum SpendableOutputDescriptor {
98
98
to_self_delay : u16 ,
99
99
/// The output which is referenced by the given outpoint
100
100
output : TxOut ,
101
- /// The channel keys state used to proceed to derivation of signing key. Must
102
- /// be pass to KeysInterface::derive_channel_keys.
103
- key_derivation_params : ( u64 , u64 ) ,
104
101
/// The revocation_pubkey used to derive witnessScript
105
- revocation_pubkey : PublicKey
102
+ revocation_pubkey : PublicKey ,
103
+ /// Arbitrary identification information returned by a call to
104
+ /// `ChannelKeys::key_derivation_params()`. This may be useful in re-deriving keys used in
105
+ /// the channel to spend the output.
106
+ key_derivation_params : ( u64 , u64 ) ,
107
+ /// The value of the channel which this transactions spends.
108
+ channel_value_satoshis : u64 ,
106
109
} ,
107
110
/// An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
108
111
/// corresponds to the public key in ChannelKeys::pubkeys().payment_point).
@@ -116,9 +119,12 @@ pub enum SpendableOutputDescriptor {
116
119
outpoint : OutPoint ,
117
120
/// The output which is reference by the given outpoint
118
121
output : TxOut ,
119
- /// The channel keys state used to proceed to derivation of signing key. Must
120
- /// be pass to KeysInterface::derive_channel_keys.
122
+ /// Arbitrary identification information returned by a call to
123
+ /// `ChannelKeys::key_derivation_params()`. This may be useful in re-deriving keys used in
124
+ /// the channel to spend the output.
121
125
key_derivation_params : ( u64 , u64 ) ,
126
+ /// The value of the channel which this transactions spends.
127
+ channel_value_satoshis : u64 ,
122
128
}
123
129
}
124
130
@@ -130,22 +136,24 @@ impl Writeable for SpendableOutputDescriptor {
130
136
outpoint. write ( writer) ?;
131
137
output. write ( writer) ?;
132
138
} ,
133
- & SpendableOutputDescriptor :: DynamicOutputP2WSH { ref outpoint, ref per_commitment_point, ref to_self_delay, ref output, ref key_derivation_params , ref revocation_pubkey } => {
139
+ & SpendableOutputDescriptor :: DynamicOutputP2WSH { ref outpoint, ref per_commitment_point, ref to_self_delay, ref output, ref revocation_pubkey , ref key_derivation_params , channel_value_satoshis } => {
134
140
1u8 . write ( writer) ?;
135
141
outpoint. write ( writer) ?;
136
142
per_commitment_point. write ( writer) ?;
137
143
to_self_delay. write ( writer) ?;
138
144
output. write ( writer) ?;
145
+ revocation_pubkey. write ( writer) ?;
139
146
key_derivation_params. 0 . write ( writer) ?;
140
147
key_derivation_params. 1 . write ( writer) ?;
141
- revocation_pubkey . write ( writer) ?;
148
+ channel_value_satoshis . write ( writer) ?;
142
149
} ,
143
- & SpendableOutputDescriptor :: StaticOutputCounterpartyPayment { ref outpoint, ref output, ref key_derivation_params } => {
150
+ & SpendableOutputDescriptor :: StaticOutputCounterpartyPayment { ref outpoint, ref output, ref key_derivation_params, channel_value_satoshis } => {
144
151
2u8 . write ( writer) ?;
145
152
outpoint. write ( writer) ?;
146
153
output. write ( writer) ?;
147
154
key_derivation_params. 0 . write ( writer) ?;
148
155
key_derivation_params. 1 . write ( writer) ?;
156
+ channel_value_satoshis. write ( writer) ?;
149
157
} ,
150
158
}
151
159
Ok ( ( ) )
@@ -164,13 +172,15 @@ impl Readable for SpendableOutputDescriptor {
164
172
per_commitment_point : Readable :: read ( reader) ?,
165
173
to_self_delay : Readable :: read ( reader) ?,
166
174
output : Readable :: read ( reader) ?,
167
- key_derivation_params : ( Readable :: read ( reader) ?, Readable :: read ( reader) ?) ,
168
175
revocation_pubkey : Readable :: read ( reader) ?,
176
+ key_derivation_params : ( Readable :: read ( reader) ?, Readable :: read ( reader) ?) ,
177
+ channel_value_satoshis : Readable :: read ( reader) ?,
169
178
} ) ,
170
179
2u8 => Ok ( SpendableOutputDescriptor :: StaticOutputCounterpartyPayment {
171
180
outpoint : Readable :: read ( reader) ?,
172
181
output : Readable :: read ( reader) ?,
173
182
key_derivation_params : ( Readable :: read ( reader) ?, Readable :: read ( reader) ?) ,
183
+ channel_value_satoshis : Readable :: read ( reader) ?,
174
184
} ) ,
175
185
_ => Err ( DecodeError :: InvalidValue ) ,
176
186
}
0 commit comments