Skip to content

Commit 95fe325

Browse files
committed
rustfmt and clean up get_onchain_failed_outbound_htlcs
1 parent 0a264e8 commit 95fe325

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
@@ -3007,29 +3007,29 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
30073007
/// This is similar to [`Self::get_pending_or_resolved_outbound_htlcs`] except it includes
30083008
/// HTLCs which were resolved on-chain (i.e. where the final HTLC resolution was done by an
30093009
/// event from this `ChannelMonitor`).
3010-
#[rustfmt::skip]
3011-
pub(crate) fn get_all_current_outbound_htlcs(&self) -> HashMap<HTLCSource, (HTLCOutputInCommitment, Option<PaymentPreimage>)> {
3010+
pub(crate) fn get_all_current_outbound_htlcs(
3011+
&self,
3012+
) -> HashMap<HTLCSource, (HTLCOutputInCommitment, Option<PaymentPreimage>)> {
30123013
let mut res = new_hash_map();
30133014
// Just examine the available counterparty commitment transactions. See docs on
30143015
// `fail_unbroadcast_htlcs`, below, for justification.
30153016
let us = self.inner.lock().unwrap();
3016-
macro_rules! walk_counterparty_commitment {
3017-
($txid: expr) => {
3018-
if let Some(ref latest_outpoints) = us.funding.counterparty_claimable_outpoints.get($txid) {
3019-
for &(ref htlc, ref source_option) in latest_outpoints.iter() {
3020-
if let &Some(ref source) = source_option {
3021-
res.insert((**source).clone(), (htlc.clone(),
3022-
us.counterparty_fulfilled_htlcs.get(&SentHTLCId::from_source(source)).cloned()));
3023-
}
3017+
let mut walk_counterparty_commitment = |txid| {
3018+
if let Some(latest_outpoints) = us.funding.counterparty_claimable_outpoints.get(txid) {
3019+
for &(ref htlc, ref source_option) in latest_outpoints.iter() {
3020+
if let &Some(ref source) = source_option {
3021+
let htlc_id = SentHTLCId::from_source(source);
3022+
let preimage_opt = us.counterparty_fulfilled_htlcs.get(&htlc_id).cloned();
3023+
res.insert((**source).clone(), (htlc.clone(), preimage_opt));
30243024
}
30253025
}
30263026
}
3027-
}
3027+
};
30283028
if let Some(ref txid) = us.funding.current_counterparty_commitment_txid {
3029-
walk_counterparty_commitment!(txid);
3029+
walk_counterparty_commitment(txid);
30303030
}
30313031
if let Some(ref txid) = us.funding.prev_counterparty_commitment_txid {
3032-
walk_counterparty_commitment!(txid);
3032+
walk_counterparty_commitment(txid);
30333033
}
30343034
res
30353035
}

0 commit comments

Comments
 (0)