self.update_ret.lock().unwrap().clone()
}
+ fn get_monitor_would_broadcast(&self, funding_txo: &OutPoint, height: u32) -> bool {
+ self.simple_monitor.get_monitor_would_broadcast(funding_txo, height)
+ }
+
fn get_and_clear_pending_htlcs_updated(&self) -> Vec<HTLCUpdate> {
return self.simple_monitor.get_and_clear_pending_htlcs_updated();
}
}
}
}
+ #[cfg(any(test, feature = "fuzztarget"))]
+ if channel.is_funding_initiated() {
+ // In testing/fuzzing, check that the channel's would_broadcast_at_height
+ // implementation is always identical to the ChannelMonitor equivalent.
+ for i in height..height + 144 {
+ assert_eq!(channel.monitor_would_broadcast_at_height(i, &self.logger),
+ self.monitor.get_monitor_would_broadcast(&channel.get_funding_txo().unwrap(), i));
+ }
+ }
if channel.is_funding_initiated() && channel.monitor_would_broadcast_at_height(height, &self.logger) {
if let Some(short_id) = channel.get_short_channel_id() {
short_to_id.remove(&short_id);
}
}
+ #[cfg(any(test, feature = "fuzztarget"))]
+ fn get_monitor_would_broadcast(&self, funding_txo: &OutPoint, height: u32) -> bool {
+ self.monitors.lock().unwrap().get(funding_txo).unwrap().would_broadcast_at_height(height, &self.logger)
+ }
+
fn get_and_clear_pending_htlcs_updated(&self) -> Vec<HTLCUpdate> {
let mut pending_htlcs_updated = Vec::new();
for chan in self.monitors.lock().unwrap().values_mut() {
/// ChannelMonitors via block_connected may result in FUNDS LOSS.
fn update_monitor(&self, funding_txo: OutPoint, monitor: ChannelMonitorUpdate) -> Result<(), ChannelMonitorUpdateErr>;
+ #[cfg(any(test, feature = "fuzztarget"))]
+ /// Calls would_broadcast_at_height() on the given monitor. Used in testing to check that the
+ /// ChannelMonitor copy can never get out of sync with the Channel copy.
+ fn get_monitor_would_broadcast(&self, funding_txo: &OutPoint, height: u32) -> bool;
+
/// Used by ChannelManager to get list of HTLC resolved onchain and which needed to be updated
/// with success or failure.
///
ret
}
+ fn get_monitor_would_broadcast(&self, funding_txo: &OutPoint, height: u32) -> bool {
+ self.simple_monitor.get_monitor_would_broadcast(funding_txo, height)
+ }
+
fn get_and_clear_pending_htlcs_updated(&self) -> Vec<HTLCUpdate> {
return self.simple_monitor.get_and_clear_pending_htlcs_updated();
}