+ /// Gets the set of outbound HTLCs which can be (or have been) resolved by this
+ /// `ChannelMonitor`. This is used to determine if an HTLC was removed from the channel prior
+ /// to the `ChannelManager` having been persisted.
+ ///
+ /// This is similar to [`Self::get_pending_outbound_htlcs`] except it includes HTLCs which were
+ /// resolved by this `ChannelMonitor`.
+ pub(crate) fn get_all_current_outbound_htlcs(&self) -> HashMap<HTLCSource, HTLCOutputInCommitment> {
+ let mut res = HashMap::new();
+ // Just examine the available counterparty commitment transactions. See docs on
+ // `fail_unbroadcast_htlcs`, below, for justification.
+ let us = self.inner.lock().unwrap();
+ macro_rules! walk_counterparty_commitment {
+ ($txid: expr) => {
+ if let Some(ref latest_outpoints) = us.counterparty_claimable_outpoints.get($txid) {
+ for &(ref htlc, ref source_option) in latest_outpoints.iter() {
+ if let &Some(ref source) = source_option {
+ res.insert((**source).clone(), htlc.clone());
+ }
+ }
+ }
+ }
+ }
+ if let Some(ref txid) = us.current_counterparty_commitment_txid {
+ walk_counterparty_commitment!(txid);
+ }
+ if let Some(ref txid) = us.prev_counterparty_commitment_txid {
+ walk_counterparty_commitment!(txid);
+ }
+ res
+ }
+