Skip to content

Commit e7f13f6

Browse files
committed
rustfmt and clean up get_onchain_failed_outbound_htlcs
1 parent b24f8b5 commit e7f13f6

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
@@ -2907,29 +2907,29 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
29072907
/// This is similar to [`Self::get_pending_or_resolved_outbound_htlcs`] except it includes
29082908
/// HTLCs which were resolved on-chain (i.e. where the final HTLC resolution was done by an
29092909
/// event from this `ChannelMonitor`).
2910-
#[rustfmt::skip]
2911-
pub(crate) fn get_all_current_outbound_htlcs(&self) -> HashMap<HTLCSource, (HTLCOutputInCommitment, Option<PaymentPreimage>)> {
2910+
pub(crate) fn get_all_current_outbound_htlcs(
2911+
&self,
2912+
) -> HashMap<HTLCSource, (HTLCOutputInCommitment, Option<PaymentPreimage>)> {
29122913
let mut res = new_hash_map();
29132914
// Just examine the available counterparty commitment transactions. See docs on
29142915
// `fail_unbroadcast_htlcs`, below, for justification.
29152916
let us = self.inner.lock().unwrap();
2916-
macro_rules! walk_counterparty_commitment {
2917-
($txid: expr) => {
2918-
if let Some(ref latest_outpoints) = us.funding.counterparty_claimable_outpoints.get($txid) {
2919-
for &(ref htlc, ref source_option) in latest_outpoints.iter() {
2920-
if let &Some(ref source) = source_option {
2921-
res.insert((**source).clone(), (htlc.clone(),
2922-
us.counterparty_fulfilled_htlcs.get(&SentHTLCId::from_source(source)).cloned()));
2923-
}
2917+
let mut walk_counterparty_commitment = |txid| {
2918+
if let Some(latest_outpoints) = us.funding.counterparty_claimable_outpoints.get(txid) {
2919+
for &(ref htlc, ref source_option) in latest_outpoints.iter() {
2920+
if let &Some(ref source) = source_option {
2921+
let htlc_id = SentHTLCId::from_source(source);
2922+
let preimage_opt = us.counterparty_fulfilled_htlcs.get(&htlc_id).cloned();
2923+
res.insert((**source).clone(), (htlc.clone(), preimage_opt));
29242924
}
29252925
}
29262926
}
2927-
}
2927+
};
29282928
if let Some(ref txid) = us.funding.current_counterparty_commitment_txid {
2929-
walk_counterparty_commitment!(txid);
2929+
walk_counterparty_commitment(txid);
29302930
}
29312931
if let Some(ref txid) = us.funding.prev_counterparty_commitment_txid {
2932-
walk_counterparty_commitment!(txid);
2932+
walk_counterparty_commitment(txid);
29332933
}
29342934
res
29352935
}

0 commit comments

Comments
 (0)