@@ -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 secret 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
- channel_keys_id : [ u8 ; 32 ] ,
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::channel_keys_id()`. This may be useful in re-deriving keys used in
105
+ /// the channel to spend the output.
106
+ channel_keys_id : [ u8 ; 32 ] ,
107
+ /// The value of the channel which this output originated from, possibly indirectly.
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::channel_keys_id()`. This may be useful in re-deriving keys used in
124
+ /// the channel to spend the output.
121
125
channel_keys_id : [ u8 ; 32 ] ,
126
+ /// The value of the channel which this transactions spends.
127
+ channel_value_satoshis : u64 ,
122
128
}
123
129
}
124
130
@@ -130,20 +136,22 @@ 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 channel_keys_id , ref revocation_pubkey } => {
139
+ & SpendableOutputDescriptor :: DynamicOutputP2WSH { ref outpoint, ref per_commitment_point, ref to_self_delay, ref output, ref revocation_pubkey , ref channel_keys_id , 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) ?;
139
- channel_keys_id. write ( writer) ?;
140
145
revocation_pubkey. write ( writer) ?;
146
+ channel_keys_id. write ( writer) ?;
147
+ channel_value_satoshis. write ( writer) ?;
141
148
} ,
142
- & SpendableOutputDescriptor :: StaticOutputCounterpartyPayment { ref outpoint, ref output, ref channel_keys_id } => {
149
+ & SpendableOutputDescriptor :: StaticOutputCounterpartyPayment { ref outpoint, ref output, ref channel_keys_id, channel_value_satoshis } => {
143
150
2u8 . write ( writer) ?;
144
151
outpoint. write ( writer) ?;
145
152
output. write ( writer) ?;
146
153
channel_keys_id. write ( writer) ?;
154
+ channel_value_satoshis. write ( writer) ?;
147
155
} ,
148
156
}
149
157
Ok ( ( ) )
@@ -162,13 +170,15 @@ impl Readable for SpendableOutputDescriptor {
162
170
per_commitment_point : Readable :: read ( reader) ?,
163
171
to_self_delay : Readable :: read ( reader) ?,
164
172
output : Readable :: read ( reader) ?,
165
- channel_keys_id : Readable :: read ( reader) ?,
166
173
revocation_pubkey : Readable :: read ( reader) ?,
174
+ channel_keys_id : Readable :: read ( reader) ?,
175
+ channel_value_satoshis : Readable :: read ( reader) ?,
167
176
} ) ,
168
177
2u8 => Ok ( SpendableOutputDescriptor :: StaticOutputCounterpartyPayment {
169
178
outpoint : Readable :: read ( reader) ?,
170
179
output : Readable :: read ( reader) ?,
171
180
channel_keys_id : Readable :: read ( reader) ?,
181
+ channel_value_satoshis : Readable :: read ( reader) ?,
172
182
} ) ,
173
183
_ => Err ( DecodeError :: InvalidValue ) ,
174
184
}
0 commit comments