From: Gursharan Singh <3442979+G8XSU@users.noreply.github.com> Date: Mon, 6 May 2024 20:00:52 +0000 (-0700) Subject: Stop tracking chain_sync_monitor_persistences in TestPersister X-Git-Tag: v0.0.124-beta~126^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=8861a9acfa612d5493235e0d275748cf6c56633d;p=rust-lightning Stop tracking chain_sync_monitor_persistences in TestPersister --- diff --git a/lightning/src/chain/chainmonitor.rs b/lightning/src/chain/chainmonitor.rs index bbbd60d06..0a146c940 100644 --- a/lightning/src/chain/chainmonitor.rs +++ b/lightning/src/chain/chainmonitor.rs @@ -984,7 +984,6 @@ mod tests { 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(|| { diff --git a/lightning/src/ln/payment_tests.rs b/lightning/src/ln/payment_tests.rs index 33cabbf25..b7af95931 100644 --- a/lightning/src/ln/payment_tests.rs +++ b/lightning/src/ln/payment_tests.rs @@ -1101,7 +1101,6 @@ fn do_test_dup_htlc_onchain_doesnt_fail_on_reload(persist_manager_post_event: bo // 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 { diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index 642e548e6..d3a4f7181 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -513,9 +513,6 @@ pub struct TestPersister { /// The queue of update statuses we'll return. If none are queued, ::Completed will always be /// returned. pub update_rets: Mutex>, - /// When we get an update_persisted_channel call with no ChannelMonitorUpdate, we insert the - /// MonitorId here. - pub chain_sync_monitor_persistences: Mutex>, /// When we get an update_persisted_channel call *with* a ChannelMonitorUpdate, we insert the /// [`ChannelMonitor::get_latest_update_id`] here. /// @@ -526,7 +523,6 @@ impl TestPersister { 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()), } } @@ -552,22 +548,13 @@ impl chainmonitor::Persist {}, - 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); } }