Skip to content

Commit d06ccab

Browse files
committed
Rename BaseSign to EcdsaChannelSigner to allow for TaprootChannelSigner distinction later down the line.
1 parent 02f1674 commit d06ccab

File tree

6 files changed

+29
-29
lines changed

6 files changed

+29
-29
lines changed

lightning/src/chain/keysinterface.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub struct DelayedPaymentOutputDescriptor {
7575
/// The revocation point specific to the commitment transaction which was broadcast. Used to
7676
/// derive the witnessScript for this output.
7777
pub revocation_pubkey: PublicKey,
78-
/// Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`].
78+
/// Arbitrary identification information returned by a call to [`EcdsaChannelSigner::channel_keys_id`].
7979
/// This may be useful in re-deriving keys used in the channel to spend the output.
8080
pub channel_keys_id: [u8; 32],
8181
/// The value of the channel which this output originated from, possibly indirectly.
@@ -107,7 +107,7 @@ pub struct StaticPaymentOutputDescriptor {
107107
pub outpoint: OutPoint,
108108
/// The output which is referenced by the given outpoint.
109109
pub output: TxOut,
110-
/// Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`].
110+
/// Arbitrary identification information returned by a call to [`EcdsaChannelSigner::channel_keys_id`].
111111
/// This may be useful in re-deriving keys used in the channel to spend the output.
112112
pub channel_keys_id: [u8; 32],
113113
/// The value of the channel which this transactions spends.
@@ -172,15 +172,15 @@ pub enum SpendableOutputDescriptor {
172172
///
173173
/// To derive the delayed payment key which is used to sign this input, you must pass the
174174
/// holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which corresponds to the
175-
/// [`ChannelPublicKeys::delayed_payment_basepoint`] in [`BaseSign::pubkeys`]) and the provided
175+
/// [`ChannelPublicKeys::delayed_payment_basepoint`] in [`EcdsaChannelSigner::pubkeys`]) and the provided
176176
/// [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The public key can be
177177
/// generated without the secret key using [`chan_utils::derive_public_key`] and only the
178-
/// [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`BaseSign::pubkeys`].
178+
/// [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`EcdsaChannelSigner::pubkeys`].
179179
///
180180
/// To derive the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] provided here (which is
181181
/// used in the witness script generation), you must pass the counterparty
182182
/// [`ChannelPublicKeys::revocation_basepoint`] (which appears in the call to
183-
/// [`BaseSign::provide_channel_parameters`]) and the provided
183+
/// [`EcdsaChannelSigner::provide_channel_parameters`]) and the provided
184184
/// [`DelayedPaymentOutputDescriptor::per_commitment_point`] to
185185
/// [`chan_utils::derive_public_revocation_key`].
186186
///
@@ -191,7 +191,7 @@ pub enum SpendableOutputDescriptor {
191191
/// [`chan_utils::get_revokeable_redeemscript`].
192192
DelayedPaymentOutput(DelayedPaymentOutputDescriptor),
193193
/// An output to a P2WPKH, spendable exclusively by our payment key (i.e., the private key
194-
/// which corresponds to the `payment_point` in [`BaseSign::pubkeys`]). The witness
194+
/// which corresponds to the `payment_point` in [`EcdsaChannelSigner::pubkeys`]). The witness
195195
/// in the spending input is, thus, simply:
196196
/// ```bitcoin
197197
/// <BIP 143 signature> <payment key>
@@ -219,7 +219,7 @@ impl_writeable_tlv_based_enum!(SpendableOutputDescriptor,
219219
/// policies in order to be secure. Please refer to the [VLS Policy
220220
/// Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md)
221221
/// for an example of such policies.
222-
pub trait BaseSign {
222+
pub trait EcdsaChannelSigner {
223223
/// Gets the per-commitment point for a specific commitment number
224224
///
225225
/// Note that the commitment number starts at `(1 << 48) - 1` and counts backwards.
@@ -253,7 +253,7 @@ pub trait BaseSign {
253253
fn pubkeys(&self) -> &ChannelPublicKeys;
254254
/// Returns an arbitrary identifier describing the set of keys which are provided back to you in
255255
/// some [`SpendableOutputDescriptor`] types. This should be sufficient to identify this
256-
/// [`BaseSign`] object uniquely and lookup or re-derive its keys.
256+
/// [`EcdsaChannelSigner`] object uniquely and lookup or re-derive its keys.
257257
fn channel_keys_id(&self) -> [u8; 32];
258258
/// Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
259259
///
@@ -398,7 +398,7 @@ pub trait BaseSign {
398398
/// Set the counterparty static channel data, including basepoints,
399399
/// `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint.
400400
///
401-
/// This data is static, and will never change for a channel once set. For a given [`BaseSign`]
401+
/// This data is static, and will never change for a channel once set. For a given [`EcdsaChannelSigner`]
402402
/// instance, LDK will call this method exactly once - either immediately after construction
403403
/// (not including if done via [`SignerProvider::read_chan_signer`]) or when the funding
404404
/// information has been generated.
@@ -414,7 +414,7 @@ pub trait BaseSign {
414414
///
415415
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
416416
/// [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
417-
pub trait Sign: BaseSign + Writeable {}
417+
pub trait Sign: EcdsaChannelSigner + Writeable {}
418418

419419
/// Specifies the recipient of an invoice.
420420
///
@@ -511,7 +511,7 @@ pub trait SignerProvider {
511511
/// To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through
512512
/// [`SignerProvider::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be
513513
/// re-derived from its `channel_keys_id`, which can be obtained through its trait method
514-
/// [`BaseSign::channel_keys_id`].
514+
/// [`EcdsaChannelSigner::channel_keys_id`].
515515
fn derive_channel_signer(&self, channel_value_satoshis: u64, channel_keys_id: [u8; 32]) -> Self::Signer;
516516

517517
/// Reads a [`Signer`] for this [`SignerProvider`] from the given input stream.
@@ -620,38 +620,38 @@ impl InMemorySigner {
620620

621621
/// Returns the counterparty's pubkeys.
622622
///
623-
/// Will panic if [`BaseSign::provide_channel_parameters`] has not been called before.
623+
/// Will panic if [`EcdsaChannelSigner::provide_channel_parameters`] has not been called before.
624624
pub fn counterparty_pubkeys(&self) -> &ChannelPublicKeys { &self.get_channel_parameters().counterparty_parameters.as_ref().unwrap().pubkeys }
625625
/// Returns the `contest_delay` value specified by our counterparty and applied on holder-broadcastable
626626
/// transactions, i.e., the amount of time that we have to wait to recover our funds if we
627627
/// broadcast a transaction.
628628
///
629-
/// Will panic if [`BaseSign::provide_channel_parameters`] has not been called before.
629+
/// Will panic if [`EcdsaChannelSigner::provide_channel_parameters`] has not been called before.
630630
pub fn counterparty_selected_contest_delay(&self) -> u16 { self.get_channel_parameters().counterparty_parameters.as_ref().unwrap().selected_contest_delay }
631631
/// Returns the `contest_delay` value specified by us and applied on transactions broadcastable
632632
/// by our counterparty, i.e., the amount of time that they have to wait to recover their funds
633633
/// if they broadcast a transaction.
634634
///
635-
/// Will panic if [`BaseSign::provide_channel_parameters`] has not been called before.
635+
/// Will panic if [`EcdsaChannelSigner::provide_channel_parameters`] has not been called before.
636636
pub fn holder_selected_contest_delay(&self) -> u16 { self.get_channel_parameters().holder_selected_contest_delay }
637637
/// Returns whether the holder is the initiator.
638638
///
639-
/// Will panic if [`BaseSign::provide_channel_parameters`] has not been called before.
639+
/// Will panic if [`EcdsaChannelSigner::provide_channel_parameters`] has not been called before.
640640
pub fn is_outbound(&self) -> bool { self.get_channel_parameters().is_outbound_from_holder }
641641
/// Funding outpoint
642642
///
643-
/// Will panic if [`BaseSign::provide_channel_parameters`] has not been called before.
643+
/// Will panic if [`EcdsaChannelSigner::provide_channel_parameters`] has not been called before.
644644
pub fn funding_outpoint(&self) -> &OutPoint { self.get_channel_parameters().funding_outpoint.as_ref().unwrap() }
645645
/// Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or
646646
/// building transactions.
647647
///
648-
/// Will panic if [`BaseSign::provide_channel_parameters`] has not been called before.
648+
/// Will panic if [`EcdsaChannelSigner::provide_channel_parameters`] has not been called before.
649649
pub fn get_channel_parameters(&self) -> &ChannelTransactionParameters {
650650
self.channel_parameters.as_ref().unwrap()
651651
}
652652
/// Returns whether anchors should be used.
653653
///
654-
/// Will panic if [`BaseSign::provide_channel_parameters`] has not been called before.
654+
/// Will panic if [`EcdsaChannelSigner::provide_channel_parameters`] has not been called before.
655655
pub fn opt_anchors(&self) -> bool {
656656
self.get_channel_parameters().opt_anchors.is_some()
657657
}
@@ -725,7 +725,7 @@ impl InMemorySigner {
725725
}
726726
}
727727

728-
impl BaseSign for InMemorySigner {
728+
impl EcdsaChannelSigner for InMemorySigner {
729729
fn get_per_commitment_point(&self, idx: u64, secp_ctx: &Secp256k1<secp256k1::All>) -> PublicKey {
730730
let commitment_secret = SecretKey::from_slice(&chan_utils::build_commitment_secret(&self.commitment_seed, idx)).unwrap();
731731
PublicKey::from_secret_key(secp_ctx, &commitment_secret)
@@ -1452,8 +1452,8 @@ impl PhantomKeysManager {
14521452
}
14531453
}
14541454

1455-
// Ensure that BaseSign can have a vtable
1455+
// Ensure that EcdsaChannelSigner can have a vtable
14561456
#[test]
14571457
pub fn dyn_sign() {
1458-
let _signer: Box<dyn BaseSign>;
1458+
let _signer: Box<dyn EcdsaChannelSigner>;
14591459
}

lightning/src/chain/onchaintx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use bitcoin::hash_types::{Txid, BlockHash};
2121
use bitcoin::secp256k1::{Secp256k1, ecdsa::Signature};
2222
use bitcoin::secp256k1;
2323

24-
use crate::chain::keysinterface::{BaseSign, EntropySource, SignerProvider};
24+
use crate::chain::keysinterface::{EcdsaChannelSigner, EntropySource, SignerProvider};
2525
use crate::ln::msgs::DecodeError;
2626
use crate::ln::PaymentPreimage;
2727
#[cfg(anchors)]

lightning/src/ln/chan_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,7 @@ mod tests {
16351635
use crate::ln::chan_utils::{get_htlc_redeemscript, get_to_countersignatory_with_anchors_redeemscript, CommitmentTransaction, TxCreationKeys, ChannelTransactionParameters, CounterpartyChannelTransactionParameters, HTLCOutputInCommitment};
16361636
use bitcoin::secp256k1::{PublicKey, SecretKey, Secp256k1};
16371637
use crate::util::test_utils;
1638-
use crate::chain::keysinterface::{BaseSign, SignerProvider};
1638+
use crate::chain::keysinterface::{EcdsaChannelSigner, SignerProvider};
16391639
use bitcoin::{Network, Txid};
16401640
use bitcoin::hashes::Hash;
16411641
use crate::ln::PaymentHash;

lightning/src/ln/channel.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use crate::chain::BestBlock;
3535
use crate::chain::chaininterface::{FeeEstimator, ConfirmationTarget, LowerBoundedFeeEstimator};
3636
use crate::chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, ChannelMonitorUpdateStep, LATENCY_GRACE_PERIOD_BLOCKS};
3737
use crate::chain::transaction::{OutPoint, TransactionData};
38-
use crate::chain::keysinterface::{Sign, EntropySource, BaseSign, SignerProvider, NodeSigner, Recipient};
38+
use crate::chain::keysinterface::{Sign, EntropySource, EcdsaChannelSigner, SignerProvider, NodeSigner, Recipient};
3939
use crate::util::events::ClosureReason;
4040
use crate::util::ser::{Readable, ReadableArgs, Writeable, Writer, VecWriter};
4141
use crate::util::logger::Logger;
@@ -6871,7 +6871,7 @@ mod tests {
68716871
use crate::ln::chan_utils::{htlc_success_tx_weight, htlc_timeout_tx_weight};
68726872
use crate::chain::BestBlock;
68736873
use crate::chain::chaininterface::{FeeEstimator, LowerBoundedFeeEstimator, ConfirmationTarget};
6874-
use crate::chain::keysinterface::{BaseSign, InMemorySigner, EntropySource, SignerProvider};
6874+
use crate::chain::keysinterface::{EcdsaChannelSigner, InMemorySigner, EntropySource, SignerProvider};
68756875
use crate::chain::transaction::OutPoint;
68766876
use crate::util::config::UserConfig;
68776877
use crate::util::enforcing_trait_impls::EnforcingSigner;
@@ -7376,7 +7376,7 @@ mod tests {
73767376
use bitcoin::hashes::hex::FromHex;
73777377
use bitcoin::hash_types::Txid;
73787378
use bitcoin::secp256k1::Message;
7379-
use crate::chain::keysinterface::BaseSign;
7379+
use crate::chain::keysinterface::EcdsaChannelSigner;
73807380
use crate::ln::PaymentPreimage;
73817381
use crate::ln::channel::{HTLCOutputInCommitment ,TxCreationKeys};
73827382
use crate::ln::chan_utils::{ChannelPublicKeys, HolderCommitmentTransaction, CounterpartyChannelTransactionParameters};

lightning/src/ln/functional_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::chain::chaininterface::LowerBoundedFeeEstimator;
1717
use crate::chain::channelmonitor;
1818
use crate::chain::channelmonitor::{CLTV_CLAIM_BUFFER, LATENCY_GRACE_PERIOD_BLOCKS, ANTI_REORG_DELAY};
1919
use crate::chain::transaction::OutPoint;
20-
use crate::chain::keysinterface::{BaseSign, EntropySource};
20+
use crate::chain::keysinterface::{EcdsaChannelSigner, EntropySource};
2121
use crate::ln::{PaymentPreimage, PaymentSecret, PaymentHash};
2222
use crate::ln::channel::{commitment_tx_base_weight, COMMITMENT_TX_WEIGHT_PER_HTLC, CONCURRENT_INBOUND_HTLC_FEE_BUFFER, FEE_SPIKE_BUFFER_FEE_INCREASE_MULTIPLE, MIN_AFFORDABLE_HTLC_COUNT};
2323
use crate::ln::channelmanager::{self, PaymentId, RAACommitmentOrder, PaymentSendFailure, BREAKDOWN_TIMEOUT, MIN_CLTV_EXPIRY_DELTA};

lightning/src/util/enforcing_trait_impls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use crate::ln::channel::{ANCHOR_OUTPUT_VALUE_SATOSHI, MIN_CHAN_DUST_LIMIT_SATOSHIS};
1111
use crate::ln::chan_utils::{HTLCOutputInCommitment, ChannelPublicKeys, HolderCommitmentTransaction, CommitmentTransaction, ChannelTransactionParameters, TrustedCommitmentTransaction, ClosingTransaction};
1212
use crate::ln::{chan_utils, msgs, PaymentPreimage};
13-
use crate::chain::keysinterface::{Sign, InMemorySigner, BaseSign};
13+
use crate::chain::keysinterface::{Sign, InMemorySigner, EcdsaChannelSigner};
1414

1515
use crate::prelude::*;
1616
use core::cmp;
@@ -90,7 +90,7 @@ impl EnforcingSigner {
9090
}
9191
}
9292

93-
impl BaseSign for EnforcingSigner {
93+
impl EcdsaChannelSigner for EnforcingSigner {
9494
fn get_per_commitment_point(&self, idx: u64, secp_ctx: &Secp256k1<secp256k1::All>) -> PublicKey {
9595
self.inner.get_per_commitment_point(idx, secp_ctx)
9696
}

0 commit comments

Comments
 (0)