X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=inline;f=lightning%2Fsrc%2Futil%2Ftest_utils.rs;h=6ea1265c3107603f25be46d272b64811b28dd870;hb=edab29e8d834db2b2015b5aaff1c6ff3828ab048;hp=c3884d345eebc3a013bff303cf7cdbd9fb83d80a;hpb=53052234959a3c0a7323a194c351c4ba9b46339b;p=rust-lightning diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index c3884d34..6ea1265c 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -7,6 +7,7 @@ use ln::msgs; use ln::msgs::LocalFeatures; use ln::msgs::{LightningError}; use ln::channelmonitor::HTLCUpdate; +use util::enforcing_trait_impls::EnforcingChannelKeys; use util::events; use util::logger::{Logger, Level, Record}; use util::ser::{ReadableArgs, Writer}; @@ -221,15 +222,17 @@ pub struct TestKeysInterface { } impl keysinterface::KeysInterface for TestKeysInterface { + type ChanKeySigner = EnforcingChannelKeys; + fn get_node_secret(&self) -> SecretKey { self.backing.get_node_secret() } fn get_destination_script(&self) -> Script { self.backing.get_destination_script() } fn get_shutdown_pubkey(&self) -> PublicKey { self.backing.get_shutdown_pubkey() } - fn get_channel_keys(&self, inbound: bool) -> keysinterface::ChannelKeys { self.backing.get_channel_keys(inbound) } + fn get_channel_keys(&self, inbound: bool) -> EnforcingChannelKeys { EnforcingChannelKeys::new(self.backing.get_channel_keys(inbound)) } - fn get_session_key(&self) -> SecretKey { + fn get_onion_rand(&self) -> (SecretKey, [u8; 32]) { match *self.override_session_priv.lock().unwrap() { - Some(key) => key.clone(), - None => self.backing.get_session_key() + Some(key) => (key.clone(), [0; 32]), + None => self.backing.get_onion_rand() } }