@@ -11523,55 +11523,68 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1152311523 fn internal_tx_abort(
1152411524 &self, counterparty_node_id: &PublicKey, msg: &msgs::TxAbort,
1152511525 ) -> Result<NotifyOption, MsgHandleErrInternal> {
11526- let per_peer_state = self.per_peer_state.read().unwrap();
11527- let peer_state_mutex = per_peer_state.get(counterparty_node_id).ok_or_else(|| {
11528- debug_assert!(false);
11529- MsgHandleErrInternal::no_such_peer(counterparty_node_id, msg.channel_id)
11530- })?;
11531- let mut peer_state_lock = peer_state_mutex.lock().unwrap();
11532- let peer_state = &mut *peer_state_lock;
11533- match peer_state.channel_by_id.entry(msg.channel_id) {
11534- hash_map::Entry::Occupied(mut chan_entry) => {
11535- let res = chan_entry.get_mut().tx_abort(msg, &self.logger);
11536- let (tx_abort, splice_failed) =
11537- try_channel_entry!(self, peer_state, res, chan_entry);
11526+ let (result, holding_cell_res) = {
11527+ let per_peer_state = self.per_peer_state.read().unwrap();
11528+ let peer_state_mutex = per_peer_state.get(counterparty_node_id).ok_or_else(|| {
11529+ debug_assert!(false);
11530+ MsgHandleErrInternal::no_such_peer(counterparty_node_id, msg.channel_id)
11531+ })?;
11532+ let mut peer_state_lock = peer_state_mutex.lock().unwrap();
11533+ let peer_state = &mut *peer_state_lock;
11534+ match peer_state.channel_by_id.entry(msg.channel_id) {
11535+ hash_map::Entry::Occupied(mut chan_entry) => {
11536+ let res = chan_entry.get_mut().tx_abort(msg, &self.logger);
11537+ let (tx_abort, splice_failed, exited_quiescence) =
11538+ try_channel_entry!(self, peer_state, res, chan_entry);
1153811539
11539- let persist = if tx_abort.is_some() || splice_failed.is_some() {
11540- NotifyOption::DoPersist
11541- } else {
11542- NotifyOption::SkipPersistNoEvents
11543- };
11540+ let persist = if tx_abort.is_some() || splice_failed.is_some() {
11541+ NotifyOption::DoPersist
11542+ } else {
11543+ NotifyOption::SkipPersistNoEvents
11544+ };
1154411545
11545- if let Some(tx_abort_msg) = tx_abort {
11546- peer_state.pending_msg_events.push(MessageSendEvent::SendTxAbort {
11547- node_id: *counterparty_node_id,
11548- msg: tx_abort_msg,
11549- });
11550- }
11546+ if let Some(tx_abort_msg) = tx_abort {
11547+ peer_state.pending_msg_events.push(MessageSendEvent::SendTxAbort {
11548+ node_id: *counterparty_node_id,
11549+ msg: tx_abort_msg,
11550+ });
11551+ }
1155111552
11552- if let Some(splice_funding_failed) = splice_failed {
11553- let pending_events = &mut self.pending_events.lock().unwrap();
11554- pending_events.push_back((
11555- events::Event::SpliceFailed {
11556- channel_id: msg.channel_id,
11557- counterparty_node_id: *counterparty_node_id,
11558- user_channel_id: chan_entry.get().context().get_user_id(),
11559- abandoned_funding_txo: splice_funding_failed.funding_txo,
11560- channel_type: splice_funding_failed.channel_type,
11561- contributed_inputs: splice_funding_failed.contributed_inputs,
11562- contributed_outputs: splice_funding_failed.contributed_outputs,
11563- },
11564- None,
11565- ));
11566- }
11553+ if let Some(splice_funding_failed) = splice_failed {
11554+ let pending_events = &mut self.pending_events.lock().unwrap();
11555+ pending_events.push_back((
11556+ events::Event::SpliceFailed {
11557+ channel_id: msg.channel_id,
11558+ counterparty_node_id: *counterparty_node_id,
11559+ user_channel_id: chan_entry.get().context().get_user_id(),
11560+ abandoned_funding_txo: splice_funding_failed.funding_txo,
11561+ channel_type: splice_funding_failed.channel_type,
11562+ contributed_inputs: splice_funding_failed.contributed_inputs,
11563+ contributed_outputs: splice_funding_failed.contributed_outputs,
11564+ },
11565+ None,
11566+ ));
11567+ }
1156711568
11568- Ok(persist)
11569- },
11570- hash_map::Entry::Vacant(_) => Err(MsgHandleErrInternal::no_such_channel_for_peer(
11571- counterparty_node_id,
11572- msg.channel_id,
11573- )),
11574- }
11569+ let holding_cell_res = if exited_quiescence {
11570+ self.check_free_peer_holding_cells(peer_state)
11571+ } else {
11572+ Vec::new()
11573+ };
11574+ (Ok(persist), holding_cell_res)
11575+ },
11576+ hash_map::Entry::Vacant(_) => (
11577+ Err(MsgHandleErrInternal::no_such_channel_for_peer(
11578+ counterparty_node_id,
11579+ msg.channel_id,
11580+ )),
11581+ Vec::new(),
11582+ ),
11583+ }
11584+ };
11585+
11586+ self.handle_holding_cell_free_result(holding_cell_res);
11587+ result
1157511588 }
1157611589
1157711590 #[rustfmt::skip]
0 commit comments