Skip to content

Commit 8000729

Browse files
committed
Delete StaticPaymentOutputDescriptor::witness_script
1 parent 5ef0795 commit 8000729

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

lightning/src/sign/mod.rs

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -165,22 +165,6 @@ pub struct StaticPaymentOutputDescriptor {
165165
pub witness_weight: u64,
166166
}
167167

168-
impl StaticPaymentOutputDescriptor {
169-
/// Returns the `witness_script` of the spendable output.
170-
///
171-
/// Note that this will only return `Some` for [`StaticPaymentOutputDescriptor`]s that
172-
/// originated from an anchor outputs channel, as they take the form of a P2WSH script.
173-
pub fn witness_script(&self) -> Option<ScriptBuf> {
174-
self.channel_transaction_parameters.as_ref().and_then(|channel_params| {
175-
if channel_params.supports_anchors() {
176-
let payment_point = channel_params.holder_pubkeys.payment_point;
177-
Some(chan_utils::get_to_countersignatory_with_anchors_redeemscript(&payment_point))
178-
} else {
179-
None
180-
}
181-
})
182-
}
183-
}
184168
impl_writeable_tlv_based!(StaticPaymentOutputDescriptor, {
185169
(0, outpoint, required),
186170
(2, output, required),
@@ -405,10 +389,18 @@ impl SpendableOutputDescriptor {
405389
..Default::default()
406390
}
407391
},
408-
SpendableOutputDescriptor::StaticPaymentOutput(descriptor) => bitcoin::psbt::Input {
409-
witness_utxo: Some(descriptor.output.clone()),
410-
witness_script: descriptor.witness_script(),
411-
..Default::default()
392+
SpendableOutputDescriptor::StaticPaymentOutput(descriptor) => {
393+
let witness_script = descriptor.channel_transaction_parameters.as_ref().and_then(|channel_params| {
394+
channel_params.supports_anchors().then(|| {
395+
let payment_point = channel_params.holder_pubkeys.payment_point;
396+
chan_utils::get_to_countersignatory_with_anchors_redeemscript(&payment_point)
397+
})
398+
});
399+
bitcoin::psbt::Input {
400+
witness_utxo: Some(descriptor.output.clone()),
401+
witness_script,
402+
..Default::default()
403+
}
412404
},
413405
}
414406
}

0 commit comments

Comments
 (0)