@@ -6984,8 +6984,7 @@ where
6984
6984
fn maybe_generate_initial_closing_signed(&self) -> bool {
6985
6985
let mut handle_errors: Vec<(PublicKey, Result<(), _>)> = Vec::new();
6986
6986
let mut has_update = false;
6987
- let mut shutdown_result = None;
6988
- let mut unbroadcasted_batch_funding_txid = None;
6987
+ let mut shutdown_results = Vec::new();
6989
6988
{
6990
6989
let per_peer_state = self.per_peer_state.read().unwrap();
6991
6990
@@ -6996,7 +6995,7 @@ where
6996
6995
peer_state.channel_by_id.retain(|channel_id, phase| {
6997
6996
match phase {
6998
6997
ChannelPhase::Funded(chan) => {
6999
- unbroadcasted_batch_funding_txid = chan.context.unbroadcasted_batch_funding_txid();
6998
+ let unbroadcasted_batch_funding_txid = chan.context.unbroadcasted_batch_funding_txid();
7000
6999
match chan.maybe_propose_closing_signed(&self.fee_estimator, &self.logger) {
7001
7000
Ok((msg_opt, tx_opt)) => {
7002
7001
if let Some(msg) = msg_opt {
@@ -7019,7 +7018,7 @@ where
7019
7018
log_info!(self.logger, "Broadcasting {}", log_tx!(tx));
7020
7019
self.tx_broadcaster.broadcast_transactions(&[&tx]);
7021
7020
update_maps_on_chan_removal!(self, &chan.context);
7022
- shutdown_result = Some ((None, Vec::new(), unbroadcasted_batch_funding_txid));
7021
+ shutdown_results.push ((None, Vec::new(), unbroadcasted_batch_funding_txid));
7023
7022
false
7024
7023
} else { true }
7025
7024
},
@@ -7041,7 +7040,7 @@ where
7041
7040
let _ = handle_error!(self, err, counterparty_node_id);
7042
7041
}
7043
7042
7044
- if let Some( shutdown_result) = shutdown_result {
7043
+ for shutdown_result in shutdown_results.drain(..) {
7045
7044
self.finish_close_channel(shutdown_result);
7046
7045
}
7047
7046
0 commit comments