Skip to content

Commit 737df0f

Browse files
Merge pull request #3128 from TheBlueMatt/2024-06-no-claim-ret
Drop unused return value from `claim_funds_from_hop`
2 parents baefe5a + fea6393 commit 737df0f

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6159,21 +6159,13 @@ where
61596159
}
61606160
if valid_mpp {
61616161
for htlc in sources.drain(..) {
6162-
let prev_hop_chan_id = htlc.prev_hop.channel_id;
6163-
if let Err((pk, err)) = self.claim_funds_from_hop(
6162+
self.claim_funds_from_hop(
61646163
htlc.prev_hop, payment_preimage,
61656164
|_, definitely_duplicate| {
61666165
debug_assert!(!definitely_duplicate, "We shouldn't claim duplicatively from a payment");
61676166
Some(MonitorUpdateCompletionAction::PaymentClaimed { payment_hash })
61686167
}
6169-
) {
6170-
if let msgs::ErrorAction::IgnoreError = err.err.action {
6171-
// We got a temporary failure updating monitor, but will claim the
6172-
// HTLC when the monitor updating is restored (or on chain).
6173-
let logger = WithContext::from(&self.logger, None, Some(prev_hop_chan_id), Some(payment_hash));
6174-
log_error!(logger, "Temporary failure claiming HTLC, treating as success: {}", err.err.err);
6175-
} else { errs.push((pk, err)); }
6176-
}
6168+
);
61776169
}
61786170
}
61796171
if !valid_mpp {
@@ -6195,9 +6187,10 @@ where
61956187
}
61966188
}
61976189

6198-
fn claim_funds_from_hop<ComplFunc: FnOnce(Option<u64>, bool) -> Option<MonitorUpdateCompletionAction>>(&self,
6199-
prev_hop: HTLCPreviousHopData, payment_preimage: PaymentPreimage, completion_action: ComplFunc)
6200-
-> Result<(), (PublicKey, MsgHandleErrInternal)> {
6190+
fn claim_funds_from_hop<ComplFunc: FnOnce(Option<u64>, bool) -> Option<MonitorUpdateCompletionAction>>(
6191+
&self, prev_hop: HTLCPreviousHopData, payment_preimage: PaymentPreimage,
6192+
completion_action: ComplFunc,
6193+
) {
62016194
//TODO: Delay the claimed_funds relaying just like we do outbound relay!
62026195

62036196
// If we haven't yet run background events assume we're still deserializing and shouldn't
@@ -6259,7 +6252,7 @@ where
62596252
let action = if let Some(action) = completion_action(None, true) {
62606253
action
62616254
} else {
6262-
return Ok(());
6255+
return;
62636256
};
62646257
mem::drop(peer_state_lock);
62656258

@@ -6275,7 +6268,7 @@ where
62756268
} else {
62766269
debug_assert!(false,
62776270
"Duplicate claims should always free another channel immediately");
6278-
return Ok(());
6271+
return;
62796272
};
62806273
if let Some(peer_state_mtx) = per_peer_state.get(&node_id) {
62816274
let mut peer_state = peer_state_mtx.lock().unwrap();
@@ -6300,7 +6293,7 @@ where
63006293
}
63016294
}
63026295
}
6303-
return Ok(());
6296+
return;
63046297
}
63056298
}
63066299
}
@@ -6348,7 +6341,6 @@ where
63486341
// generally always allowed to be duplicative (and it's specifically noted in
63496342
// `PaymentForwarded`).
63506343
self.handle_monitor_update_completion_actions(completion_action(None, false));
6351-
Ok(())
63526344
}
63536345

63546346
fn finalize_claims(&self, sources: Vec<HTLCSource>) {
@@ -6381,7 +6373,7 @@ where
63816373
let completed_blocker = RAAMonitorUpdateBlockingAction::from_prev_hop_data(&hop_data);
63826374
#[cfg(debug_assertions)]
63836375
let claiming_chan_funding_outpoint = hop_data.outpoint;
6384-
let res = self.claim_funds_from_hop(hop_data, payment_preimage,
6376+
self.claim_funds_from_hop(hop_data, payment_preimage,
63856377
|htlc_claim_value_msat, definitely_duplicate| {
63866378
let chan_to_release =
63876379
if let Some(node_id) = next_channel_counterparty_node_id {
@@ -6475,10 +6467,6 @@ where
64756467
})
64766468
}
64776469
});
6478-
if let Err((pk, err)) = res {
6479-
let result: Result<(), _> = Err(err);
6480-
let _ = handle_error!(self, result, pk);
6481-
}
64826470
},
64836471
}
64846472
}

0 commit comments

Comments
 (0)