Skip to content

Commit ec800b6

Browse files
committed
rustfmt and clean up get_onchain_failed_outbound_htlcs
Backport of 9186900 Resolved trivial conflicts in: * lightning/src/chain/channelmonitor.rs due to splicing's introduction of the `funding` field in monitors.
1 parent 05edf12 commit ec800b6

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2553,28 +2553,29 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
25532553
/// This is similar to [`Self::get_pending_or_resolved_outbound_htlcs`] except it includes
25542554
/// HTLCs which were resolved on-chain (i.e. where the final HTLC resolution was done by an
25552555
/// event from this `ChannelMonitor`).
2556-
pub(crate) fn get_all_current_outbound_htlcs(&self) -> HashMap<HTLCSource, (HTLCOutputInCommitment, Option<PaymentPreimage>)> {
2556+
pub(crate) fn get_all_current_outbound_htlcs(
2557+
&self,
2558+
) -> HashMap<HTLCSource, (HTLCOutputInCommitment, Option<PaymentPreimage>)> {
25572559
let mut res = new_hash_map();
25582560
// Just examine the available counterparty commitment transactions. See docs on
25592561
// `fail_unbroadcast_htlcs`, below, for justification.
25602562
let us = self.inner.lock().unwrap();
2561-
macro_rules! walk_counterparty_commitment {
2562-
($txid: expr) => {
2563-
if let Some(ref latest_outpoints) = us.counterparty_claimable_outpoints.get($txid) {
2564-
for &(ref htlc, ref source_option) in latest_outpoints.iter() {
2565-
if let &Some(ref source) = source_option {
2566-
res.insert((**source).clone(), (htlc.clone(),
2567-
us.counterparty_fulfilled_htlcs.get(&SentHTLCId::from_source(source)).cloned()));
2568-
}
2563+
let mut walk_counterparty_commitment = |txid| {
2564+
if let Some(latest_outpoints) = us.counterparty_claimable_outpoints.get(txid) {
2565+
for &(ref htlc, ref source_option) in latest_outpoints.iter() {
2566+
if let &Some(ref source) = source_option {
2567+
let htlc_id = SentHTLCId::from_source(source);
2568+
let preimage_opt = us.counterparty_fulfilled_htlcs.get(&htlc_id).cloned();
2569+
res.insert((**source).clone(), (htlc.clone(), preimage_opt));
25692570
}
25702571
}
25712572
}
2572-
}
2573+
};
25732574
if let Some(ref txid) = us.current_counterparty_commitment_txid {
2574-
walk_counterparty_commitment!(txid);
2575+
walk_counterparty_commitment(txid);
25752576
}
25762577
if let Some(ref txid) = us.prev_counterparty_commitment_txid {
2577-
walk_counterparty_commitment!(txid);
2578+
walk_counterparty_commitment(txid);
25782579
}
25792580
res
25802581
}

0 commit comments

Comments
 (0)