Skip to content

Commit c60812b

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 e7784a6 commit c60812b

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
@@ -723,9 +723,10 @@ impl KeysManager {
723723
/// Note that until the 0.1 release there is no guarantee of backward compatibility between
724724
/// versions. Once the library is more fully supported, the docs will be updated to include a
725725
/// detailed description of the guarantee.
726-
pub fn new(seed: &[u8; 32], network: Network, starting_time_secs: u64, starting_time_nanos: u32) -> Self {
726+
pub fn new(seed: &[u8; 32], starting_time_secs: u64, starting_time_nanos: u32) -> Self {
727727
let secp_ctx = Secp256k1::signing_only();
728-
match ExtendedPrivKey::new_master(network.clone(), seed) {
728+
// Note that when we aren't serializing the key, network doesn't matter
729+
match ExtendedPrivKey::new_master(Network::Testnet, seed) {
729730
Ok(master_key) => {
730731
let node_secret = master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(0).unwrap()).expect("Your RNG is busted").private_key.key;
731732
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)