X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Ftest_utils.rs;h=1838b1078a98d42adbd96f15af3ab93cd01f9426;hb=9cbbb583333d6c5de8822e7e9427c17621c22a96;hp=5b101e345e22aa8e889f67a8e700c2155305a21b;hpb=19516c041e4527f6475e7bdcb046f463a374d468;p=rust-lightning diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index 5b101e34..1838b107 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -24,6 +24,7 @@ use crate::ln::script::ShutdownScript; use crate::routing::gossip::NetworkGraph; use crate::routing::router::{find_route, InFlightHtlcs, Route, RouteHop, RouteParameters, Router, ScorerAccountingForInFlightHtlcs}; use crate::routing::scoring::FixedPenaltyScorer; +use crate::util::config::UserConfig; use crate::util::enforcing_trait_impls::{EnforcingSigner, EnforcementState}; use crate::util::events; use crate::util::logger::{Logger, Level, Record}; @@ -140,9 +141,6 @@ impl SignerProvider for OnlyReadsKeysInterface { fn get_shutdown_scriptpubkey(&self) -> ShutdownScript { unreachable!(); } } -impl keysinterface::KeysInterface for OnlyReadsKeysInterface { -} - pub struct TestChainMonitor<'a> { pub added_monitors: Mutex)>>, pub monitor_updates: Mutex>>, @@ -178,7 +176,7 @@ impl<'a> chain::Watch for TestChainMonitor<'a> { let mut w = TestVecWriter(Vec::new()); monitor.write(&mut w).unwrap(); let new_monitor = <(BlockHash, channelmonitor::ChannelMonitor)>::read( - &mut io::Cursor::new(&w.0), self.keys_manager).unwrap().1; + &mut io::Cursor::new(&w.0), (self.keys_manager, self.keys_manager)).unwrap().1; assert!(new_monitor == monitor); self.latest_monitor_update_id.lock().unwrap().insert(funding_txo.to_channel_id(), (funding_txo, monitor.get_latest_update_id(), MonitorUpdateId::from_new_monitor(&monitor))); @@ -212,7 +210,7 @@ impl<'a> chain::Watch for TestChainMonitor<'a> { w.0.clear(); monitor.write(&mut w).unwrap(); let new_monitor = <(BlockHash, channelmonitor::ChannelMonitor)>::read( - &mut io::Cursor::new(&w.0), self.keys_manager).unwrap().1; + &mut io::Cursor::new(&w.0), (self.keys_manager, self.keys_manager)).unwrap().1; assert!(new_monitor == *monitor); self.added_monitors.lock().unwrap().push((funding_txo, new_monitor)); update_res @@ -339,10 +337,10 @@ impl Drop for TestChannelMessageHandler { } impl msgs::ChannelMessageHandler for TestChannelMessageHandler { - fn handle_open_channel(&self, _their_node_id: &PublicKey, _their_features: InitFeatures, msg: &msgs::OpenChannel) { + fn handle_open_channel(&self, _their_node_id: &PublicKey, msg: &msgs::OpenChannel) { self.received_msg(wire::Message::OpenChannel(msg.clone())); } - fn handle_accept_channel(&self, _their_node_id: &PublicKey, _their_features: InitFeatures, msg: &msgs::AcceptChannel) { + fn handle_accept_channel(&self, _their_node_id: &PublicKey, msg: &msgs::AcceptChannel) { self.received_msg(wire::Message::AcceptChannel(msg.clone())); } fn handle_funding_created(&self, _their_node_id: &PublicKey, msg: &msgs::FundingCreated) { @@ -354,7 +352,7 @@ impl msgs::ChannelMessageHandler for TestChannelMessageHandler { fn handle_channel_ready(&self, _their_node_id: &PublicKey, msg: &msgs::ChannelReady) { self.received_msg(wire::Message::ChannelReady(msg.clone())); } - fn handle_shutdown(&self, _their_node_id: &PublicKey, _their_features: &InitFeatures, msg: &msgs::Shutdown) { + fn handle_shutdown(&self, _their_node_id: &PublicKey, msg: &msgs::Shutdown) { self.received_msg(wire::Message::Shutdown(msg.clone())); } fn handle_closing_signed(&self, _their_node_id: &PublicKey, msg: &msgs::ClosingSigned) { @@ -400,10 +398,10 @@ impl msgs::ChannelMessageHandler for TestChannelMessageHandler { self.received_msg(wire::Message::Error(msg.clone())); } fn provided_node_features(&self) -> NodeFeatures { - channelmanager::provided_node_features() + channelmanager::provided_node_features(&UserConfig::default()) } fn provided_init_features(&self, _their_init_features: &PublicKey) -> InitFeatures { - channelmanager::provided_init_features() + channelmanager::provided_init_features(&UserConfig::default()) } } @@ -713,8 +711,6 @@ impl SignerProvider for TestKeysInterface { } } -impl keysinterface::KeysInterface for TestKeysInterface {} - impl TestKeysInterface { pub fn new(seed: &[u8; 32], network: Network) -> Self { let now = Duration::from_secs(genesis_block(network).header.time as u64);