Skip to content

Commit 5aeb582

Browse files
author
Antoine Riard
committed
Remove temporary anti-duplicata logic
1 parent 4d2d4fa commit 5aeb582

File tree

3 files changed

+2
-17
lines changed

3 files changed

+2
-17
lines changed

lightning/src/ln/functional_test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ pub fn fail_payment<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, expected_route:
992992
pub fn create_chanmon_cfgs(node_count: usize) -> Vec<TestChanMonCfg> {
993993
let mut chan_mon_cfgs = Vec::new();
994994
for _ in 0..node_count {
995-
let tx_broadcaster = test_utils::TestBroadcaster{txn_broadcasted: Mutex::new(Vec::new()), broadcasted_txn: Mutex::new(HashMap::new())};
995+
let tx_broadcaster = test_utils::TestBroadcaster{txn_broadcasted: Mutex::new(Vec::new())};
996996
let fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: 253 };
997997
chan_mon_cfgs.push(TestChanMonCfg{ tx_broadcaster, fee_estimator });
998998
}

lightning/src/ln/functional_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6761,7 +6761,7 @@ fn test_data_loss_protect() {
67616761
let logger: Arc<Logger> = Arc::new(test_utils::TestLogger::with_id(format!("node {}", 0)));
67626762
let mut chan_monitor = <(Sha256dHash, ChannelMonitor<EnforcingChannelKeys>)>::read(&mut ::std::io::Cursor::new(previous_chan_monitor_state.0), Arc::clone(&logger)).unwrap().1;
67636763
let chain_monitor = Arc::new(ChainWatchInterfaceUtil::new(Network::Testnet, Arc::clone(&logger)));
6764-
tx_broadcaster = test_utils::TestBroadcaster{txn_broadcasted: Mutex::new(Vec::new()), broadcasted_txn: Mutex::new(HashMap::new())};
6764+
tx_broadcaster = test_utils::TestBroadcaster{txn_broadcasted: Mutex::new(Vec::new())};
67656765
fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: 253 };
67666766
keys_manager = test_utils::TestKeysInterface::new(&nodes[0].node_seed, Network::Testnet, Arc::clone(&logger));
67676767
monitor = test_utils::TestChannelMonitor::new(chain_monitor.clone(), &tx_broadcaster, logger.clone(), &fee_estimator);

lightning/src/util/test_utils.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,9 @@ impl<'a> channelmonitor::ManyChannelMonitor<EnforcingChannelKeys> for TestChanne
108108

109109
pub struct TestBroadcaster {
110110
pub txn_broadcasted: Mutex<Vec<Transaction>>,
111-
pub broadcasted_txn: Mutex<HashMap<Sha256dHash, u8>> // Temporary field while refactoring out tx duplication
112111
}
113112
impl chaininterface::BroadcasterInterface for TestBroadcaster {
114113
fn broadcast_transaction(&self, tx: &Transaction) {
115-
let mut already = false;
116-
{
117-
if let Some(counter) = self.broadcasted_txn.lock().unwrap().get_mut(&tx.txid()) {
118-
match counter {
119-
0 => { *counter = 1; already = true }, // We still authorize at least 2 duplicata for a given TXID to account ChannelManager/ChannelMonitor broadcast
120-
1 => return,
121-
_ => panic!()
122-
}
123-
}
124-
}
125-
if !already {
126-
self.broadcasted_txn.lock().unwrap().insert(tx.txid(), 0);
127-
}
128-
print!("\nFRESH BROADCAST {}\n\n", tx.txid());
129114
self.txn_broadcasted.lock().unwrap().push(tx.clone());
130115
}
131116
}

0 commit comments

Comments
 (0)