use bitcoin::secp256k1;
use bitcoin::secp256k1::{SecretKey, PublicKey};
use bitcoin::secp256k1::{Secp256k1, ecdsa::Signature};
+#[cfg(anchors)]
+use crate::util::events::HTLCDescriptor;
use crate::util::ser::{Writeable, Writer};
use crate::io::Error;
Ok(self.inner.sign_justice_revoked_htlc(justice_tx, input, amount, per_commitment_key, htlc, secp_ctx).unwrap())
}
+ #[cfg(anchors)]
+ fn sign_holder_htlc_transaction(
+ &self, htlc_tx: &Transaction, input: usize, htlc_descriptor: &HTLCDescriptor,
+ secp_ctx: &Secp256k1<secp256k1::All>
+ ) -> Result<Signature, ()> {
+ let per_commitment_point = self.get_per_commitment_point(htlc_descriptor.per_commitment_number, secp_ctx);
+ assert_eq!(htlc_tx.input[input], htlc_descriptor.unsigned_tx_input());
+ assert_eq!(htlc_tx.output[input], htlc_descriptor.tx_output(&per_commitment_point, secp_ctx));
+ Ok(self.inner.sign_holder_htlc_transaction(htlc_tx, input, htlc_descriptor, secp_ctx).unwrap())
+ }
+
fn sign_counterparty_htlc_transaction(&self, htlc_tx: &Transaction, input: usize, amount: u64, per_commitment_point: &PublicKey, htlc: &HTLCOutputInCommitment, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<Signature, ()> {
Ok(self.inner.sign_counterparty_htlc_transaction(htlc_tx, input, amount, per_commitment_point, htlc, secp_ctx).unwrap())
}
self.inner.sign_holder_anchor_input(anchor_tx, input, secp_ctx)
}
- fn sign_channel_announcement(&self, msg: &msgs::UnsignedChannelAnnouncement, secp_ctx: &Secp256k1<secp256k1::All>)
- -> Result<(Signature, Signature), ()> {
- self.inner.sign_channel_announcement(msg, secp_ctx)
+ fn sign_channel_announcement_with_funding_key(
+ &self, msg: &msgs::UnsignedChannelAnnouncement, secp_ctx: &Secp256k1<secp256k1::All>
+ ) -> Result<Signature, ()> {
+ self.inner.sign_channel_announcement_with_funding_key(msg, secp_ctx)
}
- fn ready_channel(&mut self, channel_parameters: &ChannelTransactionParameters) {
- self.inner.ready_channel(channel_parameters)
+ fn provide_channel_parameters(&mut self, channel_parameters: &ChannelTransactionParameters) {
+ self.inner.provide_channel_parameters(channel_parameters)
}
}
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), Error> {
// EnforcingSigner has two fields - `inner` ([`InMemorySigner`]) and `state`
// ([`EnforcementState`]). `inner` is serialized here and deserialized by
- // [`KeysInterface::read_chan_signer`]. `state` is managed by [`KeysInterface`]
+ // [`SignerProvider::read_chan_signer`]. `state` is managed by [`SignerProvider`]
// and will be serialized as needed by the implementation of that trait.
self.inner.write(writer)?;
Ok(())