@@ -5473,38 +5473,46 @@ where
54735473								}
54745474							}
54755475							UpdateFulfillCommitFetch::DuplicateClaim {} => {
5476- 								if let Some(action) = completion_action(None, true) {
5477- 									log_trace!(self.logger, "Completing monitor update completion action for channel {} as claim was redundant: {:?}",
5478- 										chan_id, action);
5479- 									mem::drop(peer_state_lock);
5480- 									if let MonitorUpdateCompletionAction::FreeOtherChannelImmediately {
5481- 										downstream_counterparty_and_funding_outpoint
5482- 									} = action {
5483- 										let (node_id, funding_outpoint, blocker) =
5484- 											downstream_counterparty_and_funding_outpoint;
5485- 										if let Some(peer_state_mtx) = per_peer_state.get(&node_id) {
5486- 											let mut peer_state = peer_state_mtx.lock().unwrap();
5487- 											if let Some(blockers) = peer_state.actions_blocking_raa_monitor_updates
5488- 												.get_mut(&funding_outpoint.to_channel_id())
5489- 											{
5490- 												let mut found_blocker = false;
5491- 												blockers.retain(|iter| {
5492- 													// Note that we could actually be blocked, in
5493- 													// which case we need to only remove the one
5494- 													// blocker which was added duplicatively.
5495- 													let first_blocker = !found_blocker;
5496- 													if *iter == blocker { found_blocker = true; }
5497- 													*iter != blocker || !first_blocker
5498- 												});
5499- 												debug_assert!(found_blocker);
5500- 											}
5501- 										} else {
5502- 											debug_assert!(false);
5503- 										}
5504- 									} else {
5505- 										debug_assert!(false,
5506- 											"Duplicate claims should always free another channel immediately");
5476+ 								let action = if let Some(action) = completion_action(None, true) {
5477+ 									action
5478+ 								} else {
5479+ 									return Ok(());
5480+ 								};
5481+ 								mem::drop(peer_state_lock);
5482+ 
5483+ 								log_trace!(self.logger, "Completing monitor update completion action for channel {} as claim was redundant: {:?}",
5484+ 									chan_id, action);
5485+ 								let (node_id, funding_outpoint, blocker) =
5486+ 								if let MonitorUpdateCompletionAction::FreeOtherChannelImmediately {
5487+ 									downstream_counterparty_node_id: node_id,
5488+ 									downstream_funding_outpoint: funding_outpoint,
5489+ 									blocking_action: blocker,
5490+ 								} = action {
5491+ 									(node_id, funding_outpoint, blocker)
5492+ 								} else {
5493+ 									debug_assert!(false,
5494+ 										"Duplicate claims should always free another channel immediately");
5495+ 									return Ok(());
5496+ 								};
5497+ 								if let Some(peer_state_mtx) = per_peer_state.get(&node_id) {
5498+ 									let mut peer_state = peer_state_mtx.lock().unwrap();
5499+ 									if let Some(blockers) = peer_state
5500+ 										.actions_blocking_raa_monitor_updates
5501+ 										.get_mut(&funding_outpoint.to_channel_id())
5502+ 									{
5503+ 										let mut found_blocker = false;
5504+ 										blockers.retain(|iter| {
5505+ 											// Note that we could actually be blocked, in
5506+ 											// which case we need to only remove the one
5507+ 											// blocker which was added duplicatively.
5508+ 											let first_blocker = !found_blocker;
5509+ 											if *iter == blocker { found_blocker = true; }
5510+ 											*iter != blocker || !first_blocker
5511+ 										});
5512+ 										debug_assert!(found_blocker);
55075513									}
5514+ 								} else {
5515+ 									debug_assert!(false);
55085516								}
55095517							}
55105518						}
0 commit comments