Skip to content

Commit 8a20905

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

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

lightning/src/sign/mod.rs

Lines changed: 15 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,21 @@ 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 =
394+
descriptor.channel_transaction_parameters.as_ref().and_then(|channel_params| {
395+
channel_params.supports_anchors().then(|| {
396+
let payment_point = channel_params.holder_pubkeys.payment_point;
397+
chan_utils::get_to_countersignatory_with_anchors_redeemscript(
398+
&payment_point,
399+
)
400+
})
401+
});
402+
bitcoin::psbt::Input {
403+
witness_utxo: Some(descriptor.output.clone()),
404+
witness_script,
405+
..Default::default()
406+
}
412407
},
413408
}
414409
}

0 commit comments

Comments
 (0)