Skip to content

Commit 28e47c2

Browse files
committed
Drop unused Network argument to KeysManager::new().
KeyManager::new() took a bitcoin::Network parameter which needs to be passed to the BIP 32 Extended Key constructor, but because we never write out the BIP 32 serialization, it isn't used. Instead, we just pass a dummy value into `ExtendedPrivKey`, dropping the unused argument to KeysManager::new().
1 parent 835a064 commit 28e47c2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lightning/src/chain/keysinterface.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,9 +727,10 @@ impl KeysManager {
727727
/// Note that until the 0.1 release there is no guarantee of backward compatibility between
728728
/// versions. Once the library is more fully supported, the docs will be updated to include a
729729
/// detailed description of the guarantee.
730-
pub fn new(seed: &[u8; 32], network: Network, starting_time_secs: u64, starting_time_nanos: u32) -> Self {
730+
pub fn new(seed: &[u8; 32], starting_time_secs: u64, starting_time_nanos: u32) -> Self {
731731
let secp_ctx = Secp256k1::signing_only();
732-
match ExtendedPrivKey::new_master(network.clone(), seed) {
732+
// Note that when we aren't serializing the key, network doesn't matter
733+
match ExtendedPrivKey::new_master(Network::Testnet, seed) {
733734
Ok(master_key) => {
734735
let node_secret = master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(0).unwrap()).expect("Your RNG is busted").private_key.key;
735736
let destination_script = match master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(1).unwrap()) {

lightning/src/util/test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ impl TestKeysInterface {
475475
pub fn new(seed: &[u8; 32], network: Network) -> Self {
476476
let now = Duration::from_secs(genesis_block(network).header.time as u64);
477477
Self {
478-
backing: keysinterface::KeysManager::new(seed, network, now.as_secs(), now.subsec_nanos()),
478+
backing: keysinterface::KeysManager::new(seed, now.as_secs(), now.subsec_nanos()),
479479
override_session_priv: Mutex::new(None),
480480
override_channel_id_priv: Mutex::new(None),
481481
disable_revocation_policy_check: false,

0 commit comments

Comments
 (0)