Skip to content

Commit cac2479

Browse files
committed
rustfmt and clean up get_onchain_failed_outbound_htlcs
1 parent aba56d6 commit cac2479

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2956,29 +2956,29 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
29562956
/// This is similar to [`Self::get_pending_or_resolved_outbound_htlcs`] except it includes
29572957
/// HTLCs which were resolved on-chain (i.e. where the final HTLC resolution was done by an
29582958
/// event from this `ChannelMonitor`).
2959-
#[rustfmt::skip]
2960-
pub(crate) fn get_all_current_outbound_htlcs(&self) -> HashMap<HTLCSource, (HTLCOutputInCommitment, Option<PaymentPreimage>)> {
2959+
pub(crate) fn get_all_current_outbound_htlcs(
2960+
&self,
2961+
) -> HashMap<HTLCSource, (HTLCOutputInCommitment, Option<PaymentPreimage>)> {
29612962
let mut res = new_hash_map();
29622963
// Just examine the available counterparty commitment transactions. See docs on
29632964
// `fail_unbroadcast_htlcs`, below, for justification.
29642965
let us = self.inner.lock().unwrap();
2965-
macro_rules! walk_counterparty_commitment {
2966-
($txid: expr) => {
2967-
if let Some(ref latest_outpoints) = us.funding.counterparty_claimable_outpoints.get($txid) {
2968-
for &(ref htlc, ref source_option) in latest_outpoints.iter() {
2969-
if let &Some(ref source) = source_option {
2970-
res.insert((**source).clone(), (htlc.clone(),
2971-
us.counterparty_fulfilled_htlcs.get(&SentHTLCId::from_source(source)).cloned()));
2972-
}
2966+
let mut walk_counterparty_commitment = |txid| {
2967+
if let Some(latest_outpoints) = us.funding.counterparty_claimable_outpoints.get(txid) {
2968+
for &(ref htlc, ref source_option) in latest_outpoints.iter() {
2969+
if let &Some(ref source) = source_option {
2970+
let htlc_id = SentHTLCId::from_source(source);
2971+
let preimage_opt = us.counterparty_fulfilled_htlcs.get(&htlc_id).cloned();
2972+
res.insert((**source).clone(), (htlc.clone(), preimage_opt));
29732973
}
29742974
}
29752975
}
2976-
}
2976+
};
29772977
if let Some(ref txid) = us.funding.current_counterparty_commitment_txid {
2978-
walk_counterparty_commitment!(txid);
2978+
walk_counterparty_commitment(txid);
29792979
}
29802980
if let Some(ref txid) = us.funding.prev_counterparty_commitment_txid {
2981-
walk_counterparty_commitment!(txid);
2981+
walk_counterparty_commitment(txid);
29822982
}
29832983
res
29842984
}

0 commit comments

Comments
 (0)