Skip to content

Commit

Permalink
f pass tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jbesraa committed Mar 30, 2024
1 parent 6d58544 commit 4a2a20c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lightning/src/ln/monitor_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ fn do_chanmon_claim_value_coop_close(anchors: bool) {
user_config.manually_accept_inbound_channels = true;
}
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(user_config), Some(user_config)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);

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

#[test]
Expand Down
4 changes: 4 additions & 0 deletions lightning/src/util/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1388,6 +1388,10 @@ impl TestChainSource {
watched_outputs: Mutex::new(new_hash_set()),
}
}
pub fn reset_watched_txn_and_outputs(&self, outpoint: OutPoint, txid: Txid, script_pubkey: ScriptBuf) {
self.watched_outputs.lock().unwrap().remove(&(outpoint, script_pubkey.clone()));
self.watched_txn.lock().unwrap().remove(&(txid, script_pubkey));
}
}

impl UtxoLookup for TestChainSource {
Expand Down

0 comments on commit 4a2a20c

Please sign in to comment.