X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Ftest_utils.rs;h=6b4d2acd4d993263674d0f987a6b53bf62276609;hb=37c431ad687e338bdef2248a746c41eb013b3573;hp=a340d95a745a66196af98270ad4477382f95f783;hpb=8c334cb579a7fc2688744f0d22279fe37ae81eff;p=rust-lightning diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index a340d95a..6b4d2acd 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -24,7 +24,7 @@ use crate::routing::router::{CandidateRouteHop, FirstHopCandidate, PublicHopCand use crate::sign; use crate::events; use crate::events::bump_transaction::{WalletSource, Utxo}; -use crate::ln::ChannelId; +use crate::ln::types::ChannelId; use crate::ln::channelmanager::{ChannelDetails, self}; #[cfg(test)] use crate::ln::chan_utils::CommitmentTransaction; @@ -504,6 +504,10 @@ impl chainmonitor::Persist>::archive_persisted_channel(&self.persister, funding_txo); + } } pub struct TestPersister { @@ -552,6 +556,18 @@ 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. + assert!(self.chain_sync_monitor_persistences.lock().unwrap().remove(&funding_txo).is_some()); + } + }; + } } pub struct TestStore { @@ -1366,6 +1382,10 @@ impl TestChainSource { watched_outputs: Mutex::new(new_hash_set()), } } + pub fn remove_watched_txn_and_outputs(&self, outpoint: OutPoint, script_pubkey: ScriptBuf) { + self.watched_outputs.lock().unwrap().remove(&(outpoint, script_pubkey.clone())); + self.watched_txn.lock().unwrap().remove(&(outpoint.txid, script_pubkey)); + } } impl UtxoLookup for TestChainSource {