Skip to content

Commit 92819dc

Browse files
committed
Use read lock on individual monitor.
1 parent adc8da7 commit 92819dc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lightning/src/chain/chainmonitor.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,8 @@ where C::Target: chain::Filter,
288288
{
289289
let funding_outpoints: HashSet<OutPoint> = HashSet::from_iter(self.monitors.read().unwrap().keys().cloned());
290290
for funding_outpoint in funding_outpoints.iter() {
291-
let monitor_lock = self.monitors.write().unwrap();
292-
let monitor_state = monitor_lock.get(funding_outpoint);
293-
if let Some(monitor_state) = monitor_state {
291+
let monitor_lock = self.monitors.read().unwrap();
292+
if let Some(monitor_state) = monitor_lock.get(funding_outpoint) {
294293
self.update_monitor_with_chain_data(header, best_height, txdata, &process, funding_outpoint, &monitor_state);
295294
}
296295
}

0 commit comments

Comments
 (0)