Skip to content

Commit 6b2487f

Browse files
committed
Expose the node secret key in {Phantom,}KeysManager
When we removed the private keys from the signing interface we forgot to re-add them in the public interface of our own implementations, which users may need.
1 parent a9e6341 commit 6b2487f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lightning/src/chain/keysinterface.rs

+17
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,12 @@ impl KeysManager {
10641064
Err(_) => panic!("Your rng is busted"),
10651065
}
10661066
}
1067+
1068+
/// Gets the "node_id" secret key used to sign gossip announcements, decode onion data, etc.
1069+
pub fn get_node_secret_key(&self) -> SecretKey {
1070+
self.node_secret
1071+
}
1072+
10671073
/// Derive an old [`WriteableEcdsaChannelSigner`] containing per-channel secrets based on a key derivation parameters.
10681074
pub fn derive_channel_keys(&self, channel_value_satoshis: u64, params: &[u8; 32]) -> InMemorySigner {
10691075
let chan_id = u64::from_be_bytes(params[0..8].try_into().unwrap());
@@ -1458,6 +1464,17 @@ impl PhantomKeysManager {
14581464
pub fn derive_channel_keys(&self, channel_value_satoshis: u64, params: &[u8; 32]) -> InMemorySigner {
14591465
self.inner.derive_channel_keys(channel_value_satoshis, params)
14601466
}
1467+
1468+
/// Gets the "node_id" secret key used to sign gossip announcements, decode onion data, etc.
1469+
pub fn get_node_secret_key(&self) -> SecretKey {
1470+
self.inner.get_node_secret_key()
1471+
}
1472+
1473+
/// Gets the "node_id" secret key of the phantom node used to sign invoices, decode the
1474+
/// last-hop onion data, etc.
1475+
pub fn get_node_secret_key(&self) -> SecretKey {
1476+
self.phantom_secret
1477+
}
14611478
}
14621479

14631480
// Ensure that EcdsaChannelSigner can have a vtable

0 commit comments

Comments
 (0)