X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fsign%2Fmod.rs;h=04c4446e2c0c8c75bd4f2f7e3b415b8f35296cf2;hb=34f8dd9a49060676da0cf4157613cfb5fd58cf1e;hp=04652166f05978b6dd8bb1ab0a4b4c2ed9c37d5f;hpb=fa2a2efef47b5da48ac7a239f3d8a835a7f28164;p=rust-lightning diff --git a/lightning/src/sign/mod.rs b/lightning/src/sign/mod.rs index 04652166..04c4446e 100644 --- a/lightning/src/sign/mod.rs +++ b/lightning/src/sign/mod.rs @@ -107,6 +107,12 @@ impl_writeable_tlv_based!(DelayedPaymentOutputDescriptor, { (12, channel_value_satoshis, required), }); +pub(crate) const P2WPKH_WITNESS_WEIGHT: u64 = 1 /* num stack items */ + + 1 /* sig length */ + + 73 /* sig including sighash flag */ + + 1 /* pubkey length */ + + 33 /* pubkey */; + /// Information about a spendable output to our "payment key". /// /// See [`SpendableOutputDescriptor::StaticPaymentOutput`] for more details on how to spend this. @@ -128,6 +134,22 @@ pub struct StaticPaymentOutputDescriptor { pub channel_transaction_parameters: Option, } impl StaticPaymentOutputDescriptor { + /// Returns the `witness_script` of the spendable output. + /// + /// Note that this will only return `Some` for [`StaticPaymentOutputDescriptor`]s that + /// originated from an anchor outputs channel, as they take the form of a P2WSH script. + pub fn witness_script(&self) -> Option