spendable_outputs.push(SpendableOutputDescriptor::StaticOutput {
outpoint: OutPoint { txid: tx.txid(), index: i as u16 },
output: outp.clone(),
+ channel_keys_id: Some(self.channel_keys_id),
});
}
if let Some(ref broadcasted_holder_revokable_script) = self.broadcasted_holder_revokable_script {
spendable_outputs.push(SpendableOutputDescriptor::StaticOutput {
outpoint: OutPoint { txid: tx.txid(), index: i as u16 },
output: outp.clone(),
+ channel_keys_id: Some(self.channel_keys_id),
});
}
}
outpoint: OutPoint,
/// The output which is referenced by the given outpoint.
output: TxOut,
+ /// The `channel_keys_id` for the channel which this output came from.
+ ///
+ /// For channels which were generated on LDK 0.0.119 or later, this is the value which was
+ /// passed to the [`SignerProvider::get_destination_script`] call which provided this
+ /// output script.
+ ///
+ /// For channels which were generated prior to LDK 0.0.119, no such argument existed,
+ /// however this field may still be filled in if such data is available.
+ channel_keys_id: Option<[u8; 32]>
},
/// An output to a P2WSH script which can be spent with a single signature after an `OP_CSV`
/// delay.
impl_writeable_tlv_based_enum!(SpendableOutputDescriptor,
(0, StaticOutput) => {
(0, outpoint, required),
+ (1, channel_keys_id, option),
(2, output, required),
},
;
{ witness_weight -= 1; } // Guarantees a low R signature
input_value += descriptor.output.value;
},
- SpendableOutputDescriptor::StaticOutput { ref outpoint, ref output } => {
+ SpendableOutputDescriptor::StaticOutput { ref outpoint, ref output, .. } => {
if !output_set.insert(*outpoint) { return Err(()); }
input.push(TxIn {
previous_output: outpoint.into_bitcoin_outpoint(),
let witness = keys_cache.as_ref().unwrap().0.sign_dynamic_p2wsh_input(&psbt.unsigned_tx, input_idx, &descriptor, &secp_ctx)?;
psbt.inputs[input_idx].final_script_witness = Some(witness);
},
- SpendableOutputDescriptor::StaticOutput { ref outpoint, ref output } => {
+ SpendableOutputDescriptor::StaticOutput { ref outpoint, ref output, .. } => {
let input_idx = psbt.unsigned_tx.input.iter().position(|i| i.previous_output == outpoint.into_bitcoin_outpoint()).ok_or(())?;
let derivation_idx = if output.script_pubkey == self.destination_script {
1