Skip to content

Commit a301c9a

Browse files
committed
Remove custom derive_channel_signer methods
The custom derive_channel_signer methods on AnchorDescriptor and HTLCDescriptor simply delegate to the passed SignerProvider now that providing ChannelTransactionParameters is no longer needed. Drop these methods and replace them with the method bodies at the call sites.
1 parent a450042 commit a301c9a

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

lightning/src/events/bump_transaction.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,6 @@ impl AnchorDescriptor {
9191
let channel_params = self.channel_derivation_parameters.transaction_parameters.as_holder_broadcastable();
9292
chan_utils::build_anchor_input_witness(&channel_params.broadcaster_pubkeys().funding_pubkey, signature)
9393
}
94-
95-
/// Derives the channel signer required to sign the anchor input.
96-
pub fn derive_channel_signer<S: EcdsaChannelSigner, SP: Deref>(&self, signer_provider: &SP) -> S
97-
where
98-
SP::Target: SignerProvider<EcdsaSigner= S>
99-
{
100-
signer_provider.derive_channel_signer(self.channel_derivation_parameters.keys_id)
101-
}
10294
}
10395

10496
/// Represents the different types of transactions, originating from LDK, to be bumped.
@@ -684,7 +676,7 @@ where
684676
log_debug!(self.logger, "Signing anchor transaction {}", anchor_txid);
685677
anchor_tx = self.utxo_source.sign_psbt(anchor_psbt)?;
686678

687-
let signer = anchor_descriptor.derive_channel_signer(&self.signer_provider);
679+
let signer = self.signer_provider.derive_channel_signer(anchor_descriptor.channel_derivation_parameters.keys_id);
688680
let channel_parameters = &anchor_descriptor.channel_derivation_parameters.transaction_parameters;
689681
let anchor_sig = signer.sign_holder_anchor_input(channel_parameters, &anchor_tx, 0, &self.secp)?;
690682
anchor_tx.input[0].witness = anchor_descriptor.tx_input_witness(&anchor_sig);
@@ -787,8 +779,9 @@ where
787779

788780
let mut signers = BTreeMap::new();
789781
for (idx, htlc_descriptor) in htlc_descriptors.iter().enumerate() {
790-
let signer = signers.entry(htlc_descriptor.channel_derivation_parameters.keys_id)
791-
.or_insert_with(|| htlc_descriptor.derive_channel_signer(&self.signer_provider));
782+
let keys_id = htlc_descriptor.channel_derivation_parameters.keys_id;
783+
let signer = signers.entry(keys_id)
784+
.or_insert_with(|| self.signer_provider.derive_channel_signer(keys_id));
792785
let htlc_sig = signer.sign_holder_htlc_transaction(&htlc_tx, idx, htlc_descriptor, &self.secp)?;
793786
let witness_script = htlc_descriptor.witness_script(&self.secp);
794787
htlc_tx.input[idx].witness = htlc_descriptor.tx_input_witness(&htlc_sig, &witness_script);

lightning/src/sign/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ use crate::sign::ecdsa::EcdsaChannelSigner;
6868
use crate::sign::taproot::TaprootChannelSigner;
6969
use crate::util::atomic_counter::AtomicCounter;
7070
use core::convert::TryInto;
71-
use core::ops::Deref;
7271
use core::sync::atomic::{AtomicUsize, Ordering};
7372
#[cfg(taproot)]
7473
use musig2::types::{PartialSignature, PublicNonce};
@@ -703,14 +702,6 @@ impl HTLCDescriptor {
703702
&self.channel_derivation_parameters.transaction_parameters.channel_type_features,
704703
)
705704
}
706-
707-
/// Derives the channel signer required to sign the HTLC input.
708-
pub fn derive_channel_signer<S: EcdsaChannelSigner, SP: Deref>(&self, signer_provider: &SP) -> S
709-
where
710-
SP::Target: SignerProvider<EcdsaSigner = S>,
711-
{
712-
signer_provider.derive_channel_signer(self.channel_derivation_parameters.keys_id)
713-
}
714705
}
715706

716707
/// A trait to handle Lightning channel key material without concretizing the channel type or

0 commit comments

Comments
 (0)