X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Ftest_utils.rs;h=6b4d2acd4d993263674d0f987a6b53bf62276609;hb=37c431ad687e338bdef2248a746c41eb013b3573;hp=305dc40a0a296e701add66f2066d8182c0eb4d78;hpb=eaf76f6cceefdc08202d7fe08e4760df0e824d38;p=rust-lightning diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index 305dc40a..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 { @@ -768,12 +784,15 @@ impl msgs::ChannelMessageHandler for TestChannelMessageHandler { fn handle_stfu(&self, _their_node_id: &PublicKey, msg: &msgs::Stfu) { self.received_msg(wire::Message::Stfu(msg.clone())); } + #[cfg(splicing)] fn handle_splice(&self, _their_node_id: &PublicKey, msg: &msgs::Splice) { self.received_msg(wire::Message::Splice(msg.clone())); } + #[cfg(splicing)] fn handle_splice_ack(&self, _their_node_id: &PublicKey, msg: &msgs::SpliceAck) { self.received_msg(wire::Message::SpliceAck(msg.clone())); } + #[cfg(splicing)] fn handle_splice_locked(&self, _their_node_id: &PublicKey, msg: &msgs::SpliceLocked) { self.received_msg(wire::Message::SpliceLocked(msg.clone())); } @@ -1363,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 {