Skip to content

Commit a442990

Browse files
committed
f check tx broadcasted events in test
1 parent 652ab55 commit a442990

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lightning/src/ln/reorg_tests.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,12 @@ fn do_test_unconf_chan(reload_node: bool, reorg_after_reload: bool, use_funding_
260260
};
261261
nodes[0].node = &nodes_0_deserialized;
262262
assert!(nodes_0_read.is_empty());
263+
if !reorg_after_reload {
264+
// If the channel is already closed when we reload the node, we'll broadcast a closing
265+
// transaction via the ChannelMonitor which is missing a corresponding channel.
266+
assert_eq!(nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().len(), 1);
267+
nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().clear();
268+
}
263269

264270
nodes[0].chain_monitor.watch_channel(chan_0_monitor.get_funding_txo().0.clone(), chan_0_monitor).unwrap();
265271
check_added_monitors!(nodes[0], 1);
@@ -290,6 +296,8 @@ fn do_test_unconf_chan(reload_node: bool, reorg_after_reload: bool, use_funding_
290296
*nodes[0].chain_monitor.expect_channel_force_closed.lock().unwrap() = Some((chan.2, true));
291297
nodes[0].node.test_process_background_events(); // Required to free the pending background monitor update
292298
check_added_monitors!(nodes[0], 1);
299+
assert_eq!(nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().len(), 1);
300+
nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().clear();
293301

294302
// Now check that we can create a new channel
295303
create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());

0 commit comments

Comments
 (0)