Skip to content

Commit 494219e

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 0c595a7 commit 494219e

File tree

3 files changed

+98
-84
lines changed

3 files changed

+98
-84
lines changed

lightning/src/ln/functional_test_utils.rs

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

3940
pub const CHAN_CONFIRM_DEPTH: u32 = 100;
4041
pub fn confirm_transaction<'a, 'b: 'a>(notifier: &'a chaininterface::BlockNotifierRef<'b>, chain: &chaininterface::ChainWatchInterfaceUtil, tx: &Transaction, chan_id: u32) {
@@ -857,7 +858,7 @@ pub fn create_node_cfgs(node_count: usize) -> Vec<NodeCfg> {
857858
let logger = Arc::new(test_utils::TestLogger::with_id(format!("node {}", i)));
858859
let fee_estimator = Arc::new(test_utils::TestFeeEstimator { sat_per_kw: 253 });
859860
let chain_monitor = Arc::new(chaininterface::ChainWatchInterfaceUtil::new(Network::Testnet, logger.clone() as Arc<Logger>));
860-
let tx_broadcaster = Arc::new(test_utils::TestBroadcaster{txn_broadcasted: Mutex::new(Vec::new())});
861+
let tx_broadcaster = Arc::new(test_utils::TestBroadcaster{txn_broadcasted: Mutex::new(Vec::new()), broadcasted_txn: Mutex::new(HashSet::new())});
861862
let mut seed = [0; 32];
862863
rng.fill_bytes(&mut seed);
863864
let keys_manager = Arc::new(test_utils::TestKeysInterface::new(&seed, Network::Testnet, logger.clone() as Arc<Logger>));

0 commit comments

Comments
 (0)