X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Ftest_utils.rs;h=2b3dea9369303b5345c7c59dc0d07f8141aced88;hb=3670dd086ca43295d186d3b957fa99a9d1c458f0;hp=b343ac35379f17195e785d70f6f6dea9dab5829e;hpb=c906f2843234ba9164e562a19bccaabde0243d95;p=rust-lightning diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index b343ac35..2b3dea93 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -45,13 +45,13 @@ impl chaininterface::FeeEstimator for TestFeeEstimator { } } -pub struct TestChannelMonitor { +pub struct TestChannelMonitor<'a> { pub added_monitors: Mutex)>>, - pub simple_monitor: channelmonitor::SimpleManyChannelMonitor, + pub simple_monitor: channelmonitor::SimpleManyChannelMonitor, pub update_ret: Mutex>, } -impl TestChannelMonitor { - pub fn new(chain_monitor: Arc, broadcaster: Arc, logger: Arc, fee_estimator: Arc) -> Self { +impl<'a> TestChannelMonitor<'a> { + pub fn new(chain_monitor: Arc, broadcaster: &'a chaininterface::BroadcasterInterface, logger: Arc, fee_estimator: Arc) -> Self { Self { added_monitors: Mutex::new(Vec::new()), simple_monitor: channelmonitor::SimpleManyChannelMonitor::new(chain_monitor, broadcaster, logger, fee_estimator), @@ -59,7 +59,7 @@ impl TestChannelMonitor { } } } -impl channelmonitor::ManyChannelMonitor for TestChannelMonitor { +impl<'a> channelmonitor::ManyChannelMonitor for TestChannelMonitor<'a> { fn add_update_monitor(&self, funding_txo: OutPoint, monitor: channelmonitor::ChannelMonitor) -> Result<(), channelmonitor::ChannelMonitorUpdateErr> { // At every point where we get a monitor update, we should be able to send a useful monitor // to a watchtower and disk... @@ -74,8 +74,8 @@ impl channelmonitor::ManyChannelMonitor for TestChannelMon self.update_ret.lock().unwrap().clone() } - fn fetch_pending_htlc_updated(&self) -> Vec { - return self.simple_monitor.fetch_pending_htlc_updated(); + fn get_and_clear_pending_htlcs_updated(&self) -> Vec { + return self.simple_monitor.get_and_clear_pending_htlcs_updated(); } }