@@ -11632,55 +11632,68 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1163211632 fn internal_tx_abort(
1163311633 &self, counterparty_node_id: &PublicKey, msg: &msgs::TxAbort,
1163411634 ) -> Result<NotifyOption, MsgHandleErrInternal> {
11635- let per_peer_state = self.per_peer_state.read().unwrap();
11636- let peer_state_mutex = per_peer_state.get(counterparty_node_id).ok_or_else(|| {
11637- debug_assert!(false);
11638- MsgHandleErrInternal::no_such_peer(counterparty_node_id, msg.channel_id)
11639- })?;
11640- let mut peer_state_lock = peer_state_mutex.lock().unwrap();
11641- let peer_state = &mut *peer_state_lock;
11642- match peer_state.channel_by_id.entry(msg.channel_id) {
11643- hash_map::Entry::Occupied(mut chan_entry) => {
11644- let res = chan_entry.get_mut().tx_abort(msg, &self.logger);
11645- let (tx_abort, splice_failed) =
11646- try_channel_entry!(self, peer_state, res, chan_entry);
11635+ let (result, holding_cell_res) = {
11636+ let per_peer_state = self.per_peer_state.read().unwrap();
11637+ let peer_state_mutex = per_peer_state.get(counterparty_node_id).ok_or_else(|| {
11638+ debug_assert!(false);
11639+ MsgHandleErrInternal::no_such_peer(counterparty_node_id, msg.channel_id)
11640+ })?;
11641+ let mut peer_state_lock = peer_state_mutex.lock().unwrap();
11642+ let peer_state = &mut *peer_state_lock;
11643+ match peer_state.channel_by_id.entry(msg.channel_id) {
11644+ hash_map::Entry::Occupied(mut chan_entry) => {
11645+ let res = chan_entry.get_mut().tx_abort(msg, &self.logger);
11646+ let (tx_abort, splice_failed, exited_quiescence) =
11647+ try_channel_entry!(self, peer_state, res, chan_entry);
1164711648
11648- let persist = if tx_abort.is_some() || splice_failed.is_some() {
11649- NotifyOption::DoPersist
11650- } else {
11651- NotifyOption::SkipPersistNoEvents
11652- };
11649+ let persist = if tx_abort.is_some() || splice_failed.is_some() {
11650+ NotifyOption::DoPersist
11651+ } else {
11652+ NotifyOption::SkipPersistNoEvents
11653+ };
1165311654
11654- if let Some(tx_abort_msg) = tx_abort {
11655- peer_state.pending_msg_events.push(MessageSendEvent::SendTxAbort {
11656- node_id: *counterparty_node_id,
11657- msg: tx_abort_msg,
11658- });
11659- }
11655+ if let Some(tx_abort_msg) = tx_abort {
11656+ peer_state.pending_msg_events.push(MessageSendEvent::SendTxAbort {
11657+ node_id: *counterparty_node_id,
11658+ msg: tx_abort_msg,
11659+ });
11660+ }
1166011661
11661- if let Some(splice_funding_failed) = splice_failed {
11662- let pending_events = &mut self.pending_events.lock().unwrap();
11663- pending_events.push_back((
11664- events::Event::SpliceFailed {
11665- channel_id: msg.channel_id,
11666- counterparty_node_id: *counterparty_node_id,
11667- user_channel_id: chan_entry.get().context().get_user_id(),
11668- abandoned_funding_txo: splice_funding_failed.funding_txo,
11669- channel_type: splice_funding_failed.channel_type,
11670- contributed_inputs: splice_funding_failed.contributed_inputs,
11671- contributed_outputs: splice_funding_failed.contributed_outputs,
11672- },
11673- None,
11674- ));
11675- }
11662+ if let Some(splice_funding_failed) = splice_failed {
11663+ let pending_events = &mut self.pending_events.lock().unwrap();
11664+ pending_events.push_back((
11665+ events::Event::SpliceFailed {
11666+ channel_id: msg.channel_id,
11667+ counterparty_node_id: *counterparty_node_id,
11668+ user_channel_id: chan_entry.get().context().get_user_id(),
11669+ abandoned_funding_txo: splice_funding_failed.funding_txo,
11670+ channel_type: splice_funding_failed.channel_type,
11671+ contributed_inputs: splice_funding_failed.contributed_inputs,
11672+ contributed_outputs: splice_funding_failed.contributed_outputs,
11673+ },
11674+ None,
11675+ ));
11676+ }
1167611677
11677- Ok(persist)
11678- },
11679- hash_map::Entry::Vacant(_) => Err(MsgHandleErrInternal::no_such_channel_for_peer(
11680- counterparty_node_id,
11681- msg.channel_id,
11682- )),
11683- }
11678+ let holding_cell_res = if exited_quiescence {
11679+ self.check_free_peer_holding_cells(peer_state)
11680+ } else {
11681+ Vec::new()
11682+ };
11683+ (Ok(persist), holding_cell_res)
11684+ },
11685+ hash_map::Entry::Vacant(_) => (
11686+ Err(MsgHandleErrInternal::no_such_channel_for_peer(
11687+ counterparty_node_id,
11688+ msg.channel_id,
11689+ )),
11690+ Vec::new(),
11691+ ),
11692+ }
11693+ };
11694+
11695+ self.handle_holding_cell_free_result(holding_cell_res);
11696+ result
1168411697 }
1168511698
1168611699 #[rustfmt::skip]
0 commit comments