- // Because we have exclusive ownership of the channel here we can release the channel_state
- // lock before add_monitor
- if let Err(e) = self.monitor.add_monitor(chan_monitor.get_funding_txo(), chan_monitor) {
- match e {
- ChannelMonitorUpdateErr::PermanentFailure => {
- match handle_error!(self, Err(MsgHandleErrInternal::from_finish_shutdown("ChannelMonitor storage failure", *temporary_channel_id, chan.force_shutdown(true), None)), chan.get_their_node_id()) {
- Err(_) => { return; },
- Ok(()) => unreachable!(),
- }
- },
- ChannelMonitorUpdateErr::TemporaryFailure => {
- // Its completely fine to continue with a FundingCreated until the monitor
- // update is persisted, as long as we don't generate the FundingBroadcastSafe
- // until the monitor has been safely persisted (as funding broadcast is not,
- // in fact, safe).
- chan.monitor_update_failed(false, false, Vec::new(), Vec::new());
- },
- }
- }