From: Matt Corallo Date: Wed, 3 Feb 2021 04:23:25 +0000 (-0500) Subject: Drop unused Network argument to KeysManager::new(). X-Git-Tag: v0.0.13~28^2~7 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=c60812bffb7706aa95e163e67775ca1ca343b499;p=rust-lightning 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(). --- diff --git a/lightning/src/chain/keysinterface.rs b/lightning/src/chain/keysinterface.rs index eaf6e5497..68c6137c8 100644 --- a/lightning/src/chain/keysinterface.rs +++ b/lightning/src/chain/keysinterface.rs @@ -723,9 +723,10 @@ impl KeysManager { /// Note that until the 0.1 release there is no guarantee of backward compatibility between /// versions. Once the library is more fully supported, the docs will be updated to include a /// detailed description of the guarantee. - pub fn new(seed: &[u8; 32], network: Network, starting_time_secs: u64, starting_time_nanos: u32) -> Self { + pub fn new(seed: &[u8; 32], starting_time_secs: u64, starting_time_nanos: u32) -> Self { let secp_ctx = Secp256k1::signing_only(); - match ExtendedPrivKey::new_master(network.clone(), seed) { + // Note that when we aren't serializing the key, network doesn't matter + match ExtendedPrivKey::new_master(Network::Testnet, seed) { Ok(master_key) => { let node_secret = master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(0).unwrap()).expect("Your RNG is busted").private_key.key; let destination_script = match master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(1).unwrap()) { diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index b758f5c65..98565bdf6 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -475,7 +475,7 @@ impl TestKeysInterface { pub fn new(seed: &[u8; 32], network: Network) -> Self { let now = Duration::from_secs(genesis_block(network).header.time as u64); Self { - backing: keysinterface::KeysManager::new(seed, network, now.as_secs(), now.subsec_nanos()), + backing: keysinterface::KeysManager::new(seed, now.as_secs(), now.subsec_nanos()), override_session_priv: Mutex::new(None), override_channel_id_priv: Mutex::new(None), disable_revocation_policy_check: false,