X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fchannelmanager.rs;h=3f6a2a6b20dfcc692df81fad93ac93c4d37a068e;hb=60567da0bd2856aa93552f7caaeabf3cc6febd01;hp=775a51afc1f31a9c2dc254f9e81dcf5960512983;hpb=c7c4226e99234ded7ade4f67ab40f4729cf9a20c;p=rust-lightning diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 775a51af..3f6a2a6b 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -3549,19 +3549,10 @@ where /// wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to /// determine the ultimate status of a payment. /// - /// # Requested Invoices - /// - /// In the case of paying a [`Bolt12Invoice`], abandoning the payment prior to receiving the - /// invoice will result in an [`Event::InvoiceRequestFailed`] and prevent any attempts at paying - /// it once received. The other events may only be generated once the invoice has been received. - /// /// # Restart Behavior /// /// If an [`Event::PaymentFailed`] is generated and we restart without first persisting the - /// [`ChannelManager`], another [`Event::PaymentFailed`] may be generated; likewise for - /// [`Event::InvoiceRequestFailed`]. - /// - /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + /// [`ChannelManager`], another [`Event::PaymentFailed`] may be generated. pub fn abandon_payment(&self, payment_id: PaymentId) { let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self); self.pending_outbound_payments.abandon_payment(payment_id, PaymentFailureReason::UserAbandoned, &self.pending_events); @@ -3902,7 +3893,7 @@ where btree_map::Entry::Vacant(vacant) => Some(vacant.insert(Vec::new())), } }); - for (channel_idx, &(temporary_channel_id, counterparty_node_id)) in temporary_channels.iter().enumerate() { + for &(temporary_channel_id, counterparty_node_id) in temporary_channels.iter() { result = result.and_then(|_| self.funding_transaction_generated_intern( temporary_channel_id, counterparty_node_id, @@ -6984,8 +6975,7 @@ where 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 mut unbroadcasted_batch_funding_txid = None; + let mut shutdown_results = Vec::new(); { let per_peer_state = self.per_peer_state.read().unwrap(); @@ -6996,7 +6986,7 @@ where peer_state.channel_by_id.retain(|channel_id, phase| { match phase { ChannelPhase::Funded(chan) => { - unbroadcasted_batch_funding_txid = chan.context.unbroadcasted_batch_funding_txid(); + let unbroadcasted_batch_funding_txid = chan.context.unbroadcasted_batch_funding_txid(); match chan.maybe_propose_closing_signed(&self.fee_estimator, &self.logger) { Ok((msg_opt, tx_opt)) => { if let Some(msg) = msg_opt { @@ -7019,7 +7009,7 @@ where 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(), unbroadcasted_batch_funding_txid)); + shutdown_results.push((None, Vec::new(), unbroadcasted_batch_funding_txid)); false } else { true } }, @@ -7041,7 +7031,7 @@ where let _ = handle_error!(self, err, counterparty_node_id); } - if let Some(shutdown_result) = shutdown_result { + for shutdown_result in shutdown_results.drain(..) { self.finish_close_channel(shutdown_result); }