Skip to content

Commit 3d0ff09

Browse files
author
Antoine Riard
committed
Remove duplicata of broadcast txn from ChannelMonitor
Previously, if new ouputs were found to be watched as part of channel operations, the block was rescan which triggers again parser and generation of transactions already issued. This commit first modifies the test framework without altering further ChannelMonitor. ChannelMonitor refactoring is introduced in a latter commit.
1 parent 11c1688 commit 3d0ff09

File tree

3 files changed

+96
-86
lines changed

3 files changed

+96
-86
lines changed

lightning/src/ln/functional_test_utils.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use std::cell::RefCell;
3434
use std::rc::Rc;
3535
use std::sync::{Arc, Mutex};
3636
use std::mem;
37+
use std::collections::HashSet;
3738

3839
pub const CHAN_CONFIRM_DEPTH: u32 = 100;
3940
pub fn confirm_transaction(notifier: &chaininterface::BlockNotifier, chain: &chaininterface::ChainWatchInterfaceUtil, tx: &Transaction, chan_id: u32) {
@@ -851,7 +852,7 @@ pub fn create_network(node_count: usize, node_config: &[Option<UserConfig>]) ->
851852
let feeest = Arc::new(test_utils::TestFeeEstimator { sat_per_kw: 253 });
852853
let chain_monitor = Arc::new(chaininterface::ChainWatchInterfaceUtil::new(Network::Testnet, Arc::clone(&logger)));
853854
let block_notifier = Arc::new(chaininterface::BlockNotifier::new(chain_monitor.clone()));
854-
let tx_broadcaster = Arc::new(test_utils::TestBroadcaster{txn_broadcasted: Mutex::new(Vec::new())});
855+
let tx_broadcaster = Arc::new(test_utils::TestBroadcaster{txn_broadcasted: Mutex::new(Vec::new()), broadcasted_txn: Mutex::new(HashSet::new())});
855856
let mut seed = [0; 32];
856857
rng.fill_bytes(&mut seed);
857858
let keys_manager = Arc::new(test_utils::TestKeysInterface::new(&seed, Network::Testnet, Arc::clone(&logger)));

0 commit comments

Comments
 (0)