Skip to content

Commit a3abac3

Browse files
committed
rustfmt and clean up get_onchain_failed_outbound_htlcs
1 parent 17e143f commit a3abac3

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
@@ -2930,29 +2930,29 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
29302930
/// This is similar to [`Self::get_pending_or_resolved_outbound_htlcs`] except it includes
29312931
/// HTLCs which were resolved on-chain (i.e. where the final HTLC resolution was done by an
29322932
/// event from this `ChannelMonitor`).
2933-
#[rustfmt::skip]
2934-
pub(crate) fn get_all_current_outbound_htlcs(&self) -> HashMap<HTLCSource, (HTLCOutputInCommitment, Option<PaymentPreimage>)> {
2933+
pub(crate) fn get_all_current_outbound_htlcs(
2934+
&self,
2935+
) -> HashMap<HTLCSource, (HTLCOutputInCommitment, Option<PaymentPreimage>)> {
29352936
let mut res = new_hash_map();
29362937
// Just examine the available counterparty commitment transactions. See docs on
29372938
// `fail_unbroadcast_htlcs`, below, for justification.
29382939
let us = self.inner.lock().unwrap();
2939-
macro_rules! walk_counterparty_commitment {
2940-
($txid: expr) => {
2941-
if let Some(ref latest_outpoints) = us.funding.counterparty_claimable_outpoints.get($txid) {
2942-
for &(ref htlc, ref source_option) in latest_outpoints.iter() {
2943-
if let &Some(ref source) = source_option {
2944-
res.insert((**source).clone(), (htlc.clone(),
2945-
us.counterparty_fulfilled_htlcs.get(&SentHTLCId::from_source(source)).cloned()));
2946-
}
2940+
let mut walk_counterparty_commitment = |txid| {
2941+
if let Some(latest_outpoints) = us.funding.counterparty_claimable_outpoints.get(txid) {
2942+
for &(ref htlc, ref source_option) in latest_outpoints.iter() {
2943+
if let &Some(ref source) = source_option {
2944+
let htlc_id = SentHTLCId::from_source(source);
2945+
let preimage_opt = us.counterparty_fulfilled_htlcs.get(&htlc_id).cloned();
2946+
res.insert((**source).clone(), (htlc.clone(), preimage_opt));
29472947
}
29482948
}
29492949
}
2950-
}
2950+
};
29512951
if let Some(ref txid) = us.funding.current_counterparty_commitment_txid {
2952-
walk_counterparty_commitment!(txid);
2952+
walk_counterparty_commitment(txid);
29532953
}
29542954
if let Some(ref txid) = us.funding.prev_counterparty_commitment_txid {
2955-
walk_counterparty_commitment!(txid);
2955+
walk_counterparty_commitment(txid);
29562956
}
29572957
res
29582958
}

0 commit comments

Comments
 (0)