let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
create_announced_chan_between_nodes(&nodes, 0, 1);
- chanmon_cfgs[0].persister.chain_sync_monitor_persistences.lock().unwrap().clear();
chanmon_cfgs[0].persister.set_update_ret(ChannelMonitorUpdateStatus::UnrecoverableError);
assert!(std::panic::catch_unwind(|| {
// Now connect the HTLC claim transaction with the ChainMonitor-generated ChannelMonitor update
// returning InProgress. This should cause the claim event to never make its way to the
// ChannelManager.
- chanmon_cfgs[0].persister.chain_sync_monitor_persistences.lock().unwrap().clear();
chanmon_cfgs[0].persister.set_update_ret(ChannelMonitorUpdateStatus::InProgress);
if payment_timeout {
/// The queue of update statuses we'll return. If none are queued, ::Completed will always be
/// returned.
pub update_rets: Mutex<VecDeque<chain::ChannelMonitorUpdateStatus>>,
- /// When we get an update_persisted_channel call with no ChannelMonitorUpdate, we insert the
- /// MonitorId here.
- pub chain_sync_monitor_persistences: Mutex<VecDeque<OutPoint>>,
/// When we get an update_persisted_channel call *with* a ChannelMonitorUpdate, we insert the
/// [`ChannelMonitor::get_latest_update_id`] here.
///
pub fn new() -> Self {
Self {
update_rets: Mutex::new(VecDeque::new()),
- chain_sync_monitor_persistences: Mutex::new(VecDeque::new()),
offchain_monitor_updates: Mutex::new(new_hash_map()),
}
}
if let Some(update) = update {
self.offchain_monitor_updates.lock().unwrap().entry(funding_txo).or_insert(new_hash_set()).insert(update.update_id);
- } else {
- self.chain_sync_monitor_persistences.lock().unwrap().push_back(funding_txo);
}
ret
}
fn archive_persisted_channel(&self, funding_txo: OutPoint) {
// remove the channel from the offchain_monitor_updates map
- match self.offchain_monitor_updates.lock().unwrap().remove(&funding_txo) {
- Some(_) => {},
- None => {
- // If the channel was not in the offchain_monitor_updates map, it should be in the
- // chain_sync_monitor_persistences map.
- self.chain_sync_monitor_persistences.lock().unwrap().retain(|x| x != &funding_txo);
- }
- };
+ self.offchain_monitor_updates.lock().unwrap().remove(&funding_txo);
}
}