Merge pull request #1930 from arik-so/2022-12-remove-keysinterface
[rust-lightning] / lightning / src / util / scid_utils.rs
index 3db98553af547039ecc24c8ed2fa236aadbc7d18..19e2f5527ccbcbcb7c997e8f628ef4cf292974e3 100644 (file)
@@ -68,7 +68,7 @@ pub fn scid_from_parts(block: u64, tx_index: u64, vout_index: u64) -> Result<u64
 pub(crate) mod fake_scid {
        use bitcoin::hash_types::BlockHash;
        use bitcoin::hashes::hex::FromHex;
-       use crate::chain::keysinterface::{KeysInterface, EntropySource};
+       use crate::chain::keysinterface::EntropySource;
        use crate::util::chacha20::ChaCha20;
        use crate::util::scid_utils;
 
@@ -101,13 +101,13 @@ pub(crate) mod fake_scid {
                /// between segwit activation and the current best known height, and the tx index and output
                /// index are also selected from a "reasonable" range. We add this logic because it makes it
                /// non-obvious at a glance that the scid is fake, e.g. if it appears in invoice route hints.
-               pub(crate) fn get_fake_scid<K: Deref>(&self, highest_seen_blockheight: u32, genesis_hash: &BlockHash, fake_scid_rand_bytes: &[u8; 32], keys_manager: &K) -> u64
-                       where K::Target: KeysInterface,
+               pub(crate) fn get_fake_scid<ES: Deref>(&self, highest_seen_blockheight: u32, genesis_hash: &BlockHash, fake_scid_rand_bytes: &[u8; 32], entropy_source: &ES) -> u64
+                       where ES::Target: EntropySource,
                {
                        // Ensure we haven't created a namespace that doesn't fit into the 3 bits we've allocated for
                        // namespaces.
                        assert!((*self as u8) < MAX_NAMESPACES);
-                       let rand_bytes = keys_manager.get_secure_random_bytes();
+                       let rand_bytes = entropy_source.get_secure_random_bytes();
 
                        let segwit_activation_height = segwit_activation_height(genesis_hash);
                        let mut blocks_since_segwit_activation = highest_seen_blockheight.saturating_sub(segwit_activation_height);