X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fchain%2Fkeysinterface.rs;h=4ad15db876bb4cad83106c89ba7ba835409b1544;hb=1ceb41e08b2d76b23d2505a10a88db8d840895ca;hp=a2611e7df87f79fefad954aa3b9133addaeb650e;hpb=3bd395f2a8a7398d7bf5ad9b2c7257e64f9c126b;p=rust-lightning diff --git a/lightning/src/chain/keysinterface.rs b/lightning/src/chain/keysinterface.rs index a2611e7d..4ad15db8 100644 --- a/lightning/src/chain/keysinterface.rs +++ b/lightning/src/chain/keysinterface.rs @@ -34,9 +34,9 @@ use bitcoin::{PackedLockTime, secp256k1, Sequence, Witness}; use crate::util::transaction_utils; use crate::util::crypto::{hkdf_extract_expand_twice, sign}; use crate::util::ser::{Writeable, Writer, Readable}; -#[cfg(anchors)] -use crate::util::events::HTLCDescriptor; use crate::chain::transaction::OutPoint; +#[cfg(anchors)] +use crate::events::bump_transaction::HTLCDescriptor; use crate::ln::channel::ANCHOR_OUTPUT_VALUE_SATOSHI; use crate::ln::{chan_utils, PaymentPreimage}; use crate::ln::chan_utils::{HTLCOutputInCommitment, make_funding_redeemscript, ChannelPublicKeys, HolderCommitmentTransaction, ChannelTransactionParameters, CommitmentTransaction, ClosingTransaction}; @@ -55,7 +55,7 @@ use crate::util::invoice::construct_invoice_preimage; /// Used as initial key material, to be expanded into multiple secret keys (but not to be used /// directly). This is used within LDK to encrypt/decrypt inbound payment data. /// -/// (C-not exported) as we just use `[u8; 32]` directly +/// This is not exported to bindings users as we just use `[u8; 32]` directly #[derive(Hash, Copy, Clone, PartialEq, Eq, Debug)] pub struct KeyMaterial(pub [u8; 32]); @@ -135,7 +135,7 @@ impl_writeable_tlv_based!(StaticPaymentOutputDescriptor, { /// outpoint describing which `txid` and output `index` is available, the full output which exists /// at that `txid`/`index`, and any keys or other information required to sign. /// -/// [`SpendableOutputs`]: crate::util::events::Event::SpendableOutputs +/// [`SpendableOutputs`]: crate::events::Event::SpendableOutputs #[derive(Clone, Debug, PartialEq, Eq)] pub enum SpendableOutputDescriptor { /// An output to a script which was provided via [`SignerProvider`] directly, either from @@ -1064,6 +1064,12 @@ impl KeysManager { Err(_) => panic!("Your rng is busted"), } } + + /// Gets the "node_id" secret key used to sign gossip announcements, decode onion data, etc. + pub fn get_node_secret_key(&self) -> SecretKey { + self.node_secret + } + /// Derive an old [`WriteableEcdsaChannelSigner`] containing per-channel secrets based on a key derivation parameters. pub fn derive_channel_keys(&self, channel_value_satoshis: u64, params: &[u8; 32]) -> InMemorySigner { let chan_id = u64::from_be_bytes(params[0..8].try_into().unwrap()); @@ -1458,6 +1464,17 @@ impl PhantomKeysManager { pub fn derive_channel_keys(&self, channel_value_satoshis: u64, params: &[u8; 32]) -> InMemorySigner { self.inner.derive_channel_keys(channel_value_satoshis, params) } + + /// Gets the "node_id" secret key used to sign gossip announcements, decode onion data, etc. + pub fn get_node_secret_key(&self) -> SecretKey { + self.inner.get_node_secret_key() + } + + /// Gets the "node_id" secret key of the phantom node used to sign invoices, decode the + /// last-hop onion data, etc. + pub fn get_phantom_node_secret_key(&self) -> SecretKey { + self.phantom_secret + } } // Ensure that EcdsaChannelSigner can have a vtable