Skip to content

Commit

Permalink
Fix map_err lint
Browse files Browse the repository at this point in the history
Use inspect_err where map_err is unnecessary.
  • Loading branch information
arik-so committed Sep 24, 2024
1 parent 23109b6 commit 646e9b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4137,10 +4137,9 @@ where
let (onion_packet, htlc_msat, htlc_cltv) = onion_utils::create_payment_onion(
&self.secp_ctx, &path, &session_priv, total_value, recipient_onion, cur_height,
payment_hash, keysend_preimage, prng_seed
).map_err(|e| {
).inspect_err(|_| {
let logger = WithContext::from(&self.logger, Some(path.hops.first().unwrap().pubkey), None, Some(*payment_hash));
log_error!(logger, "Failed to build an onion for path for payment hash {}", payment_hash);
e
})?;

let err: Result<(), _> = loop {
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/ln/outbound_payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ impl OutboundPayments {
let onion_session_privs = self.add_new_pending_payment(payment_hash, recipient_onion.clone(), payment_id, None, route, None, None, entropy_source, best_block_height)?;
self.pay_route_internal(route, payment_hash, &recipient_onion, None, payment_id, None,
onion_session_privs, node_signer, best_block_height, &send_payment_along_path)
.map_err(|e| { self.remove_outbound_if_all_failed(payment_id, &e); e })
.inspect_err(|e| { self.remove_outbound_if_all_failed(payment_id, &e); })
}

pub(super) fn send_spontaneous_payment<R: Deref, ES: Deref, NS: Deref, IH, SP, L: Deref>(
Expand Down

0 comments on commit 646e9b7

Please sign in to comment.