let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
let mut failed_htlcs: Vec<(HTLCSource, PaymentHash)>;
+ let mut shutdown_result = None;
loop {
let per_peer_state = self.per_peer_state.read().unwrap();
});
}
self.issue_channel_close_events(&chan.context, ClosureReason::HolderForceClosed);
+ shutdown_result = Some((None, Vec::new()));
}
}
break;
self.fail_htlc_backwards_internal(&htlc_source.0, &htlc_source.1, &reason, receiver);
}
+ if let Some(shutdown_result) = shutdown_result {
+ self.finish_force_close_channel(shutdown_result);
+ }
+
Ok(())
}
///
/// See [`ChannelManager::send_preflight_probes`] for more information.
pub fn send_spontaneous_preflight_probes(
- &self, node_id: PublicKey, amount_msat: u64, final_cltv_expiry_delta: u32,
+ &self, node_id: PublicKey, amount_msat: u64, final_cltv_expiry_delta: u32,
liquidity_limit_multiplier: Option<u64>,
) -> Result<Vec<(PaymentHash, PaymentId)>, ProbeSendFailure> {
let payment_params =
}
fn internal_closing_signed(&self, counterparty_node_id: &PublicKey, msg: &msgs::ClosingSigned) -> Result<(), MsgHandleErrInternal> {
+ let mut shutdown_result = None;
let per_peer_state = self.per_peer_state.read().unwrap();
let peer_state_mutex = per_peer_state.get(counterparty_node_id)
.ok_or_else(|| {
});
}
self.issue_channel_close_events(&chan.context, ClosureReason::CooperativeClosure);
+ shutdown_result = Some((None, Vec::new()));
+ }
+ mem::drop(peer_state_mutex);
+ mem::drop(per_peer_state);
+ if let Some(shutdown_result) = shutdown_result {
+ self.finish_force_close_channel(shutdown_result);
}
Ok(())
}
fn maybe_generate_initial_closing_signed(&self) -> bool {
let mut handle_errors: Vec<(PublicKey, Result<(), _>)> = Vec::new();
let mut has_update = false;
+ let mut shutdown_result = None;
{
let per_peer_state = self.per_peer_state.read().unwrap();
log_info!(self.logger, "Broadcasting {}", log_tx!(tx));
self.tx_broadcaster.broadcast_transactions(&[&tx]);
update_maps_on_chan_removal!(self, &chan.context);
+ shutdown_result = Some((None, Vec::new()));
false
} else { true }
},
let _ = handle_error!(self, err, counterparty_node_id);
}
+ if let Some(shutdown_result) = shutdown_result {
+ self.finish_force_close_channel(shutdown_result);
+ }
+
has_update
}
// Clean up for removal.
update_maps_on_chan_removal!(self, &context);
self.issue_channel_close_events(&context, ClosureReason::DisconnectedPeer);
+ failed_channels.push((None, Vec::new()));
false
});
// Note that we don't bother generating any events for pre-accept channels -