X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fchain%2Fkeysinterface.rs;h=ef9593f1881a3f0378b8653b18fc183ff0545eea;hb=fb495cd6fd547b2834af55fcb545a86ebeaf2f92;hp=a2611e7df87f79fefad954aa3b9133addaeb650e;hpb=8ecd7c30c903b9e2db0c280110200f7c61565c11;p=rust-lightning diff --git a/lightning/src/chain/keysinterface.rs b/lightning/src/chain/keysinterface.rs index a2611e7d..ef9593f1 100644 --- a/lightning/src/chain/keysinterface.rs +++ b/lightning/src/chain/keysinterface.rs @@ -425,7 +425,7 @@ pub trait EcdsaChannelSigner: ChannelSigner { /// /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager /// [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor -pub trait WriteableEcdsaChannelSigner: EcdsaChannelSigner + Writeable {} +pub trait WriteableEcdsaChannelSigner: EcdsaChannelSigner + Writeable + Clone {} /// Specifies the recipient of an invoice. /// @@ -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