]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Stop tracking chain_sync_monitor_persistences in TestPersister
authorGursharan Singh <3442979+G8XSU@users.noreply.github.com>
Mon, 6 May 2024 20:00:52 +0000 (13:00 -0700)
committerGursharan Singh <3442979+G8XSU@users.noreply.github.com>
Mon, 6 May 2024 20:00:52 +0000 (13:00 -0700)
lightning/src/chain/chainmonitor.rs
lightning/src/ln/payment_tests.rs
lightning/src/util/test_utils.rs

index bbbd60d064be1cf8070f3ae633a76192e6ff3a39..0a146c94084dc90a9fce36c6b9da01b8ab45049e 100644 (file)
@@ -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(|| {
index 33cabbf25b0f9c509a7ac225570b1cc8a0c495be..b7af959311bde258eaadeb36a33ee6e1fd1b2ab1 100644 (file)
@@ -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 {
index 642e548e606dbd0f19dd9b899258240b39bdd740..d3a4f7181cdc5dffc5000a91baa3627c2bf0c0b3 100644 (file)
@@ -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<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.
        ///
@@ -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<Signer: sign::ecdsa::WriteableEcdsaChannelSigner> chainmonitor::Persist<Sig
 
                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);
        }
 }