Skip to content

Commit 4a2a20c

Browse files
committed
f pass tests
1 parent 6d58544 commit 4a2a20c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lightning/src/ln/monitor_tests.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ fn do_chanmon_claim_value_coop_close(anchors: bool) {
171171
user_config.manually_accept_inbound_channels = true;
172172
}
173173
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(user_config), Some(user_config)]);
174-
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
174+
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
175175

176176
let (_, _, chan_id, funding_tx) =
177177
create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1_000_000, 1_000_000);
@@ -282,8 +282,10 @@ fn do_chanmon_claim_value_coop_close(anchors: bool) {
282282
connect_blocks(&nodes[0], 2017);
283283
// Second call after 2016+ blocks, should archive the monitor
284284
nodes[0].chain_monitor.chain_monitor.archive_stale_channel_monitors(vec![funding_outpoint]);
285+
assert!(nodes[0].chain_monitor.chain_monitor.get_and_clear_pending_events().is_empty());
285286
assert_eq!(nodes[0].chain_monitor.chain_monitor.list_monitors().len(), 0);
286-
// failing on test exit while dropping the node
287+
// reset watched_outputs and txn
288+
nodes.get_mut(0).unwrap().chain_source.reset_watched_txn_and_outputs(funding_outpoint, funding_tx.txid(), funding_tx.output[0].script_pubkey.clone());
287289
}
288290

289291
#[test]

lightning/src/util/test_utils.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,10 @@ impl TestChainSource {
13881388
watched_outputs: Mutex::new(new_hash_set()),
13891389
}
13901390
}
1391+
pub fn reset_watched_txn_and_outputs(&self, outpoint: OutPoint, txid: Txid, script_pubkey: ScriptBuf) {
1392+
self.watched_outputs.lock().unwrap().remove(&(outpoint, script_pubkey.clone()));
1393+
self.watched_txn.lock().unwrap().remove(&(txid, script_pubkey));
1394+
}
13911395
}
13921396

13931397
impl UtxoLookup for TestChainSource {

0 commit comments

Comments
 (0)