Eliminate unnecessary generics from Sign

The generic methods prevent Sign from being a dyn object.

Use Secp256k1<All> as part of removing generics from Secp256k1 contexts passed into Sign methods.
This commit is contained in:
Devrandom 2021-04-01 12:40:35 +02:00
parent e23c270720
commit b69ae07c11
2 changed files with 26 additions and 26 deletions

View file

@ -230,7 +230,7 @@ pub trait Sign : Send+Clone + Writeable {
/// Gets the per-commitment point for a specific commitment number /// Gets the per-commitment point for a specific commitment number
/// ///
/// Note that the commitment number starts at (1 << 48) - 1 and counts backwards. /// Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
fn get_per_commitment_point<T: secp256k1::Signing + secp256k1::Verification>(&self, idx: u64, secp_ctx: &Secp256k1<T>) -> PublicKey; fn get_per_commitment_point(&self, idx: u64, secp_ctx: &Secp256k1<secp256k1::All>) -> PublicKey;
/// Gets the commitment secret for a specific commitment number as part of the revocation process /// Gets the commitment secret for a specific commitment number as part of the revocation process
/// ///
/// An external signer implementation should error here if the commitment was already signed /// An external signer implementation should error here if the commitment was already signed
@ -253,7 +253,7 @@ pub trait Sign : Send+Clone + Writeable {
/// Note that if signing fails or is rejected, the channel will be force-closed. /// Note that if signing fails or is rejected, the channel will be force-closed.
// //
// TODO: Document the things someone using this interface should enforce before signing. // TODO: Document the things someone using this interface should enforce before signing.
fn sign_counterparty_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, commitment_tx: &CommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()>; fn sign_counterparty_commitment(&self, commitment_tx: &CommitmentTransaction, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<(Signature, Vec<Signature>), ()>;
/// Create a signatures for a holder's commitment transaction and its claiming HTLC transactions. /// Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
/// This will only ever be called with a non-revoked commitment_tx. This will be called with the /// This will only ever be called with a non-revoked commitment_tx. This will be called with the
@ -269,14 +269,14 @@ pub trait Sign : Send+Clone + Writeable {
// //
// TODO: Document the things someone using this interface should enforce before signing. // TODO: Document the things someone using this interface should enforce before signing.
// TODO: Key derivation failure should panic rather than Err // TODO: Key derivation failure should panic rather than Err
fn sign_holder_commitment_and_htlcs<T: secp256k1::Signing + secp256k1::Verification>(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()>; fn sign_holder_commitment_and_htlcs(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<(Signature, Vec<Signature>), ()>;
/// Same as sign_holder_commitment, but exists only for tests to get access to holder commitment /// Same as sign_holder_commitment, but exists only for tests to get access to holder commitment
/// transactions which will be broadcasted later, after the channel has moved on to a newer /// transactions which will be broadcasted later, after the channel has moved on to a newer
/// state. Thus, needs its own method as sign_holder_commitment may enforce that we only ever /// state. Thus, needs its own method as sign_holder_commitment may enforce that we only ever
/// get called once. /// get called once.
#[cfg(any(test,feature = "unsafe_revoked_tx_signing"))] #[cfg(any(test,feature = "unsafe_revoked_tx_signing"))]
fn unsafe_sign_holder_commitment_and_htlcs<T: secp256k1::Signing + secp256k1::Verification>(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()>; fn unsafe_sign_holder_commitment_and_htlcs(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<(Signature, Vec<Signature>), ()>;
/// Create a signature for the given input in a transaction spending an HTLC or commitment /// Create a signature for the given input in a transaction spending an HTLC or commitment
/// transaction output when our counterparty broadcasts an old state. /// transaction output when our counterparty broadcasts an old state.
@ -296,7 +296,7 @@ pub trait Sign : Send+Clone + Writeable {
/// htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus /// htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
/// changing the format of the witness script (which is committed to in the BIP 143 /// changing the format of the witness script (which is committed to in the BIP 143
/// signatures). /// signatures).
fn sign_justice_transaction<T: secp256k1::Signing + secp256k1::Verification>(&self, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey, htlc: &Option<HTLCOutputInCommitment>, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()>; fn sign_justice_transaction(&self, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey, htlc: &Option<HTLCOutputInCommitment>, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<Signature, ()>;
/// Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment /// Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
/// transaction, either offered or received. /// transaction, either offered or received.
@ -315,13 +315,13 @@ pub trait Sign : Send+Clone + Writeable {
/// detected onchain. It has been generated by our counterparty and is used to derive /// detected onchain. It has been generated by our counterparty and is used to derive
/// channel state keys, which are then included in the witness script and committed to in the /// channel state keys, which are then included in the witness script and committed to in the
/// BIP 143 signature. /// BIP 143 signature.
fn sign_counterparty_htlc_transaction<T: secp256k1::Signing + secp256k1::Verification>(&self, htlc_tx: &Transaction, input: usize, amount: u64, per_commitment_point: &PublicKey, htlc: &HTLCOutputInCommitment, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()>; 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, ()>;
/// Create a signature for a (proposed) closing transaction. /// Create a signature for a (proposed) closing transaction.
/// ///
/// Note that, due to rounding, there may be one "missing" satoshi, and either party may have /// Note that, due to rounding, there may be one "missing" satoshi, and either party may have
/// chosen to forgo their output as dust. /// chosen to forgo their output as dust.
fn sign_closing_transaction<T: secp256k1::Signing>(&self, closing_tx: &Transaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()>; fn sign_closing_transaction(&self, closing_tx: &Transaction, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<Signature, ()>;
/// Signs a channel announcement message with our funding key, proving it comes from one /// Signs a channel announcement message with our funding key, proving it comes from one
/// of the channel participants. /// of the channel participants.
@ -329,7 +329,7 @@ pub trait Sign : Send+Clone + Writeable {
/// Note that if this fails or is rejected, the channel will not be publicly announced and /// Note that if this fails or is rejected, the channel will not be publicly announced and
/// our counterparty may (though likely will not) close the channel on us for violating the /// our counterparty may (though likely will not) close the channel on us for violating the
/// protocol. /// protocol.
fn sign_channel_announcement<T: secp256k1::Signing>(&self, msg: &UnsignedChannelAnnouncement, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()>; fn sign_channel_announcement(&self, msg: &UnsignedChannelAnnouncement, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<Signature, ()>;
/// Set the counterparty static channel data, including basepoints, /// Set the counterparty static channel data, including basepoints,
/// counterparty_selected/holder_selected_contest_delay and funding outpoint. /// counterparty_selected/holder_selected_contest_delay and funding outpoint.
@ -550,7 +550,7 @@ impl InMemorySigner {
} }
impl Sign for InMemorySigner { impl Sign for InMemorySigner {
fn get_per_commitment_point<T: secp256k1::Signing + secp256k1::Verification>(&self, idx: u64, secp_ctx: &Secp256k1<T>) -> PublicKey { fn get_per_commitment_point(&self, idx: u64, secp_ctx: &Secp256k1<secp256k1::All>) -> PublicKey {
let commitment_secret = SecretKey::from_slice(&chan_utils::build_commitment_secret(&self.commitment_seed, idx)).unwrap(); let commitment_secret = SecretKey::from_slice(&chan_utils::build_commitment_secret(&self.commitment_seed, idx)).unwrap();
PublicKey::from_secret_key(secp_ctx, &commitment_secret) PublicKey::from_secret_key(secp_ctx, &commitment_secret)
} }
@ -562,7 +562,7 @@ impl Sign for InMemorySigner {
fn pubkeys(&self) -> &ChannelPublicKeys { &self.holder_channel_pubkeys } fn pubkeys(&self) -> &ChannelPublicKeys { &self.holder_channel_pubkeys }
fn channel_keys_id(&self) -> [u8; 32] { self.channel_keys_id } fn channel_keys_id(&self) -> [u8; 32] { self.channel_keys_id }
fn sign_counterparty_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, commitment_tx: &CommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()> { fn sign_counterparty_commitment(&self, commitment_tx: &CommitmentTransaction, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<(Signature, Vec<Signature>), ()> {
let trusted_tx = commitment_tx.trust(); let trusted_tx = commitment_tx.trust();
let keys = trusted_tx.keys(); let keys = trusted_tx.keys();
@ -588,7 +588,7 @@ impl Sign for InMemorySigner {
Ok((commitment_sig, htlc_sigs)) Ok((commitment_sig, htlc_sigs))
} }
fn sign_holder_commitment_and_htlcs<T: secp256k1::Signing + secp256k1::Verification>(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()> { fn sign_holder_commitment_and_htlcs(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<(Signature, Vec<Signature>), ()> {
let funding_pubkey = PublicKey::from_secret_key(secp_ctx, &self.funding_key); let funding_pubkey = PublicKey::from_secret_key(secp_ctx, &self.funding_key);
let funding_redeemscript = make_funding_redeemscript(&funding_pubkey, &self.counterparty_pubkeys().funding_pubkey); let funding_redeemscript = make_funding_redeemscript(&funding_pubkey, &self.counterparty_pubkeys().funding_pubkey);
let trusted_tx = commitment_tx.trust(); let trusted_tx = commitment_tx.trust();
@ -599,7 +599,7 @@ impl Sign for InMemorySigner {
} }
#[cfg(any(test,feature = "unsafe_revoked_tx_signing"))] #[cfg(any(test,feature = "unsafe_revoked_tx_signing"))]
fn unsafe_sign_holder_commitment_and_htlcs<T: secp256k1::Signing + secp256k1::Verification>(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()> { fn unsafe_sign_holder_commitment_and_htlcs(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<(Signature, Vec<Signature>), ()> {
let funding_pubkey = PublicKey::from_secret_key(secp_ctx, &self.funding_key); let funding_pubkey = PublicKey::from_secret_key(secp_ctx, &self.funding_key);
let funding_redeemscript = make_funding_redeemscript(&funding_pubkey, &self.counterparty_pubkeys().funding_pubkey); let funding_redeemscript = make_funding_redeemscript(&funding_pubkey, &self.counterparty_pubkeys().funding_pubkey);
let trusted_tx = commitment_tx.trust(); let trusted_tx = commitment_tx.trust();
@ -609,7 +609,7 @@ impl Sign for InMemorySigner {
Ok((sig, htlc_sigs)) Ok((sig, htlc_sigs))
} }
fn sign_justice_transaction<T: secp256k1::Signing + secp256k1::Verification>(&self, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey, htlc: &Option<HTLCOutputInCommitment>, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> { fn sign_justice_transaction(&self, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey, htlc: &Option<HTLCOutputInCommitment>, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<Signature, ()> {
let revocation_key = match chan_utils::derive_private_revocation_key(&secp_ctx, &per_commitment_key, &self.revocation_base_key) { let revocation_key = match chan_utils::derive_private_revocation_key(&secp_ctx, &per_commitment_key, &self.revocation_base_key) {
Ok(revocation_key) => revocation_key, Ok(revocation_key) => revocation_key,
Err(_) => return Err(()) Err(_) => return Err(())
@ -641,7 +641,7 @@ impl Sign for InMemorySigner {
return Ok(secp_ctx.sign(&sighash, &revocation_key)) return Ok(secp_ctx.sign(&sighash, &revocation_key))
} }
fn sign_counterparty_htlc_transaction<T: secp256k1::Signing + secp256k1::Verification>(&self, htlc_tx: &Transaction, input: usize, amount: u64, per_commitment_point: &PublicKey, htlc: &HTLCOutputInCommitment, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> { 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, ()> {
if let Ok(htlc_key) = chan_utils::derive_private_key(&secp_ctx, &per_commitment_point, &self.htlc_base_key) { if let Ok(htlc_key) = chan_utils::derive_private_key(&secp_ctx, &per_commitment_point, &self.htlc_base_key) {
let witness_script = if let Ok(revocation_pubkey) = chan_utils::derive_public_revocation_key(&secp_ctx, &per_commitment_point, &self.pubkeys().revocation_basepoint) { let witness_script = if let Ok(revocation_pubkey) = chan_utils::derive_public_revocation_key(&secp_ctx, &per_commitment_point, &self.pubkeys().revocation_basepoint) {
if let Ok(counterparty_htlcpubkey) = chan_utils::derive_public_key(&secp_ctx, &per_commitment_point, &self.counterparty_pubkeys().htlc_basepoint) { if let Ok(counterparty_htlcpubkey) = chan_utils::derive_public_key(&secp_ctx, &per_commitment_point, &self.counterparty_pubkeys().htlc_basepoint) {
@ -657,7 +657,7 @@ impl Sign for InMemorySigner {
Err(()) Err(())
} }
fn sign_closing_transaction<T: secp256k1::Signing>(&self, closing_tx: &Transaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> { fn sign_closing_transaction(&self, closing_tx: &Transaction, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<Signature, ()> {
if closing_tx.input.len() != 1 { return Err(()); } if closing_tx.input.len() != 1 { return Err(()); }
if closing_tx.input[0].witness.len() != 0 { return Err(()); } if closing_tx.input[0].witness.len() != 0 { return Err(()); }
if closing_tx.output.len() > 2 { return Err(()); } if closing_tx.output.len() > 2 { return Err(()); }
@ -670,7 +670,7 @@ impl Sign for InMemorySigner {
Ok(secp_ctx.sign(&sighash, &self.funding_key)) Ok(secp_ctx.sign(&sighash, &self.funding_key))
} }
fn sign_channel_announcement<T: secp256k1::Signing>(&self, msg: &UnsignedChannelAnnouncement, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> { fn sign_channel_announcement(&self, msg: &UnsignedChannelAnnouncement, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<Signature, ()> {
let msghash = hash_to_message!(&Sha256dHash::hash(&msg.encode()[..])[..]); let msghash = hash_to_message!(&Sha256dHash::hash(&msg.encode()[..])[..]);
Ok(secp_ctx.sign(&msghash, &self.funding_key)) Ok(secp_ctx.sign(&msghash, &self.funding_key))
} }
@ -738,7 +738,7 @@ impl Readable for InMemorySigner {
/// Cooperative closes may use seed/2' /// Cooperative closes may use seed/2'
/// The two close keys may be needed to claim on-chain funds! /// The two close keys may be needed to claim on-chain funds!
pub struct KeysManager { pub struct KeysManager {
secp_ctx: Secp256k1<secp256k1::SignOnly>, secp_ctx: Secp256k1<secp256k1::All>,
node_secret: SecretKey, node_secret: SecretKey,
destination_script: Script, destination_script: Script,
shutdown_pubkey: PublicKey, shutdown_pubkey: PublicKey,
@ -775,7 +775,7 @@ impl KeysManager {
/// versions. Once the library is more fully supported, the docs will be updated to include a /// versions. Once the library is more fully supported, the docs will be updated to include a
/// detailed description of the guarantee. /// detailed description of the guarantee.
pub fn new(seed: &[u8; 32], starting_time_secs: u64, starting_time_nanos: u32) -> Self { pub fn new(seed: &[u8; 32], starting_time_secs: u64, starting_time_nanos: u32) -> Self {
let secp_ctx = Secp256k1::signing_only(); let secp_ctx = Secp256k1::new();
// Note that when we aren't serializing the key, network doesn't matter // Note that when we aren't serializing the key, network doesn't matter
match ExtendedPrivKey::new_master(Network::Testnet, seed) { match ExtendedPrivKey::new_master(Network::Testnet, seed) {
Ok(master_key) => { Ok(master_key) => {

View file

@ -75,7 +75,7 @@ impl EnforcingSigner {
} }
impl Sign for EnforcingSigner { impl Sign for EnforcingSigner {
fn get_per_commitment_point<T: secp256k1::Signing + secp256k1::Verification>(&self, idx: u64, secp_ctx: &Secp256k1<T>) -> PublicKey { fn get_per_commitment_point(&self, idx: u64, secp_ctx: &Secp256k1<secp256k1::All>) -> PublicKey {
self.inner.get_per_commitment_point(idx, secp_ctx) self.inner.get_per_commitment_point(idx, secp_ctx)
} }
@ -91,7 +91,7 @@ impl Sign for EnforcingSigner {
fn pubkeys(&self) -> &ChannelPublicKeys { self.inner.pubkeys() } fn pubkeys(&self) -> &ChannelPublicKeys { self.inner.pubkeys() }
fn channel_keys_id(&self) -> [u8; 32] { self.inner.channel_keys_id() } fn channel_keys_id(&self) -> [u8; 32] { self.inner.channel_keys_id() }
fn sign_counterparty_commitment<T: secp256k1::Signing + secp256k1::Verification>(&self, commitment_tx: &CommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()> { fn sign_counterparty_commitment(&self, commitment_tx: &CommitmentTransaction, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<(Signature, Vec<Signature>), ()> {
self.verify_counterparty_commitment_tx(commitment_tx, secp_ctx); self.verify_counterparty_commitment_tx(commitment_tx, secp_ctx);
{ {
@ -107,7 +107,7 @@ impl Sign for EnforcingSigner {
Ok(self.inner.sign_counterparty_commitment(commitment_tx, secp_ctx).unwrap()) Ok(self.inner.sign_counterparty_commitment(commitment_tx, secp_ctx).unwrap())
} }
fn sign_holder_commitment_and_htlcs<T: secp256k1::Signing + secp256k1::Verification>(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()> { fn sign_holder_commitment_and_htlcs(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<(Signature, Vec<Signature>), ()> {
let trusted_tx = self.verify_holder_commitment_tx(commitment_tx, secp_ctx); let trusted_tx = self.verify_holder_commitment_tx(commitment_tx, secp_ctx);
let commitment_txid = trusted_tx.txid(); let commitment_txid = trusted_tx.txid();
let holder_csv = self.inner.counterparty_selected_contest_delay(); let holder_csv = self.inner.counterparty_selected_contest_delay();
@ -136,23 +136,23 @@ impl Sign for EnforcingSigner {
} }
#[cfg(any(test,feature = "unsafe_revoked_tx_signing"))] #[cfg(any(test,feature = "unsafe_revoked_tx_signing"))]
fn unsafe_sign_holder_commitment_and_htlcs<T: secp256k1::Signing + secp256k1::Verification>(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<T>) -> Result<(Signature, Vec<Signature>), ()> { fn unsafe_sign_holder_commitment_and_htlcs(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<(Signature, Vec<Signature>), ()> {
Ok(self.inner.unsafe_sign_holder_commitment_and_htlcs(commitment_tx, secp_ctx).unwrap()) Ok(self.inner.unsafe_sign_holder_commitment_and_htlcs(commitment_tx, secp_ctx).unwrap())
} }
fn sign_justice_transaction<T: secp256k1::Signing + secp256k1::Verification>(&self, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey, htlc: &Option<HTLCOutputInCommitment>, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> { fn sign_justice_transaction(&self, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey, htlc: &Option<HTLCOutputInCommitment>, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<Signature, ()> {
Ok(self.inner.sign_justice_transaction(justice_tx, input, amount, per_commitment_key, htlc, secp_ctx).unwrap()) Ok(self.inner.sign_justice_transaction(justice_tx, input, amount, per_commitment_key, htlc, secp_ctx).unwrap())
} }
fn sign_counterparty_htlc_transaction<T: secp256k1::Signing + secp256k1::Verification>(&self, htlc_tx: &Transaction, input: usize, amount: u64, per_commitment_point: &PublicKey, htlc: &HTLCOutputInCommitment, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> { 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()) Ok(self.inner.sign_counterparty_htlc_transaction(htlc_tx, input, amount, per_commitment_point, htlc, secp_ctx).unwrap())
} }
fn sign_closing_transaction<T: secp256k1::Signing>(&self, closing_tx: &Transaction, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> { fn sign_closing_transaction(&self, closing_tx: &Transaction, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<Signature, ()> {
Ok(self.inner.sign_closing_transaction(closing_tx, secp_ctx).unwrap()) Ok(self.inner.sign_closing_transaction(closing_tx, secp_ctx).unwrap())
} }
fn sign_channel_announcement<T: secp256k1::Signing>(&self, msg: &msgs::UnsignedChannelAnnouncement, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> { fn sign_channel_announcement(&self, msg: &msgs::UnsignedChannelAnnouncement, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<Signature, ()> {
self.inner.sign_channel_announcement(msg, secp_ctx) self.inner.sign_channel_announcement(msg, secp_ctx)
} }