X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Ftest_utils.rs;h=13cbde4aa1fe35c24702d277a48b310c77d08490;hb=9faf6ca85f61058f0b4eba227b8dc848f07942e5;hp=618cef0c2080f3b7fd9f34cdb6f0701a35ba6909;hpb=f60519daf21239a5fc23fd4a6af7699ea50bd7cc;p=rust-lightning diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index 618cef0c..13cbde4a 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -110,24 +110,9 @@ impl<'a> channelmonitor::ManyChannelMonitor for TestChanne pub struct TestBroadcaster { pub txn_broadcasted: Mutex>, - pub broadcasted_txn: Mutex> // Temporary field while refactoring out tx duplication } impl chaininterface::BroadcasterInterface for TestBroadcaster { fn broadcast_transaction(&self, tx: &Transaction) { - let mut already = false; - { - if let Some(counter) = self.broadcasted_txn.lock().unwrap().get_mut(&tx.txid()) { - match counter { - 0 => { *counter = 1; already = true }, // We still authorize at least 2 duplicata for a given TXID to account ChannelManager/ChannelMonitor broadcast - 1 => return, - _ => panic!() - } - } - } - if !already { - self.broadcasted_txn.lock().unwrap().insert(tx.txid(), 0); - } - print!("\nFRESH BROADCAST {}\n\n", tx.txid()); self.txn_broadcasted.lock().unwrap().push(tx.clone()); } }