fn sign_channel_announcement_with_funding_key(
&self, msg: &UnsignedChannelAnnouncement, secp_ctx: &Secp256k1<secp256k1::All>,
) -> Result<Signature, ()>;
+
+ /// Signs the input of a splicing funding transaction with our funding key.
+ ///
+ /// In splicing, the previous funding transaction output is spent as the input of
+ /// the new funding transaction, and is a 2-of-2 multisig.
+ ///
+ /// `input_index`: The index of the input within the new funding transaction `tx`,
+ /// spending the previous funding transaction's output
+ ///
+ /// `input_value`: The value of the previous funding transaction output.
+ fn sign_splicing_funding_input(
+ &self, tx: &Transaction, input_index: usize, input_value: u64,
+ secp_ctx: &Secp256k1<secp256k1::All>,
+ ) -> Result<Signature, ()>;
}
let msghash = hash_to_message!(&Sha256dHash::hash(&msg.encode()[..])[..]);
Ok(secp_ctx.sign_ecdsa(&msghash, &self.funding_key))
}
+
+ fn sign_splicing_funding_input(
+ &self, tx: &Transaction, input_index: usize, input_value: u64,
+ secp_ctx: &Secp256k1<secp256k1::All>,
+ ) -> Result<Signature, ()> {
+ let funding_pubkey = PublicKey::from_secret_key(secp_ctx, &self.funding_key);
+ let counterparty_funding_key =
+ &self.counterparty_pubkeys().expect(MISSING_PARAMS_ERR).funding_pubkey;
+ let funding_redeemscript =
+ make_funding_redeemscript(&funding_pubkey, counterparty_funding_key);
+ let sighash = &sighash::SighashCache::new(tx)
+ .p2wsh_signature_hash(
+ input_index,
+ &funding_redeemscript,
+ Amount::from_sat(input_value),
+ EcdsaSighashType::All,
+ )
+ .unwrap()[..];
+ let msg = hash_to_message!(sighash);
+ Ok(sign(secp_ctx, &msg, &self.funding_key))
+ }
}
#[cfg(taproot)]
) -> Result<Signature, ()> {
self.inner.sign_channel_announcement_with_funding_key(msg, secp_ctx)
}
+
+ fn sign_splicing_funding_input(
+ &self, tx: &Transaction, input_index: usize, input_value: u64,
+ secp_ctx: &Secp256k1<secp256k1::All>,
+ ) -> Result<Signature, ()> {
+ self.inner.sign_splicing_funding_input(tx, input_index, input_value, secp_ctx)
+ }
}
#[cfg(taproot)]