@@ -202,6 +202,15 @@ pub enum SpendableOutputDescriptor {
202202 outpoint : OutPoint ,
203203 /// The output which is referenced by the given outpoint.
204204 output : TxOut ,
205+ /// The `channel_keys_id` for the channel which this output came from.
206+ ///
207+ /// For channels which were generated on LDK 0.0.119 or later, this is the value which was
208+ /// passed to the [`SignerProvider::get_destination_script`] call which provided this
209+ /// output script.
210+ ///
211+ /// For channels which were generated prior to LDK 0.0.119, no such argument existed,
212+ /// however this field may still be filled in if such data is available.
213+ channel_keys_id : Option < [ u8 ; 32 ] >
205214 } ,
206215 /// An output to a P2WSH script which can be spent with a single signature after an `OP_CSV`
207216 /// delay.
@@ -265,6 +274,7 @@ pub enum SpendableOutputDescriptor {
265274impl_writeable_tlv_based_enum ! ( SpendableOutputDescriptor ,
266275 ( 0 , StaticOutput ) => {
267276 ( 0 , outpoint, required) ,
277+ ( 1 , channel_keys_id, option) ,
268278 ( 2 , output, required) ,
269279 } ,
270280;
@@ -365,7 +375,7 @@ impl SpendableOutputDescriptor {
365375 { witness_weight -= 1 ; } // Guarantees a low R signature
366376 input_value += descriptor. output . value ;
367377 } ,
368- SpendableOutputDescriptor :: StaticOutput { ref outpoint, ref output } => {
378+ SpendableOutputDescriptor :: StaticOutput { ref outpoint, ref output, .. } => {
369379 if !output_set. insert ( * outpoint) { return Err ( ( ) ) ; }
370380 input. push ( TxIn {
371381 previous_output : outpoint. into_bitcoin_outpoint ( ) ,
@@ -1640,7 +1650,7 @@ impl KeysManager {
16401650 let witness = keys_cache. as_ref ( ) . unwrap ( ) . 0 . sign_dynamic_p2wsh_input ( & psbt. unsigned_tx , input_idx, & descriptor, & secp_ctx) ?;
16411651 psbt. inputs [ input_idx] . final_script_witness = Some ( witness) ;
16421652 } ,
1643- SpendableOutputDescriptor :: StaticOutput { ref outpoint, ref output } => {
1653+ SpendableOutputDescriptor :: StaticOutput { ref outpoint, ref output, .. } => {
16441654 let input_idx = psbt. unsigned_tx . input . iter ( ) . position ( |i| i. previous_output == outpoint. into_bitcoin_outpoint ( ) ) . ok_or ( ( ) ) ?;
16451655 let derivation_idx = if output. script_pubkey == self . destination_script {
16461656 1
0 commit comments