@@ -4848,36 +4848,25 @@ where
4848
4848
.map_err(|e| {
4849
4849
let first_hop_key = Some(path.hops.first().unwrap().pubkey);
4850
4850
let logger = WithContext::from(&self.logger, first_hop_key, None, Some(*payment_hash));
4851
- log_error!(
4852
- logger,
4853
- "Failed to build an onion for path for payment hash {}",
4854
- payment_hash
4855
- );
4851
+ log_error!(logger, "Failed to build an onion for path for payment hash {payment_hash}");
4856
4852
e
4857
4853
})?;
4858
4854
4859
4855
let err: Result<(), _> = loop {
4860
- let first_chan_id = &path.hops.first().unwrap().short_channel_id;
4861
- let (counterparty_node_id, id) = match self
4862
- .short_to_chan_info
4863
- .read()
4864
- .unwrap()
4865
- .get(first_chan_id)
4866
- {
4856
+ let first_chan_scid = &path.hops.first().unwrap().short_channel_id;
4857
+ let first_chan = self.short_to_chan_info.read().unwrap().get(first_chan_scid).cloned();
4858
+
4859
+ let (counterparty_node_id, id) = match first_chan {
4867
4860
None => {
4868
4861
let first_hop_key = Some(path.hops.first().unwrap().pubkey);
4869
4862
let logger =
4870
4863
WithContext::from(&self.logger, first_hop_key, None, Some(*payment_hash));
4871
- log_error!(
4872
- logger,
4873
- "Failed to find first-hop for payment hash {}",
4874
- payment_hash
4875
- );
4864
+ log_error!(logger, "Failed to find first-hop for payment hash {payment_hash}");
4876
4865
return Err(APIError::ChannelUnavailable {
4877
4866
err: "No channel available with first hop!".to_owned(),
4878
4867
});
4879
4868
},
4880
- Some((cp_id, chan_id)) => (cp_id.clone() , chan_id.clone() ),
4869
+ Some((cp_id, chan_id)) => (cp_id, chan_id),
4881
4870
};
4882
4871
4883
4872
let logger = WithContext::from(
@@ -4888,9 +4877,7 @@ where
4888
4877
);
4889
4878
log_trace!(
4890
4879
logger,
4891
- "Attempting to send payment with payment hash {} along path with next hop {}",
4892
- payment_hash,
4893
- first_chan_id,
4880
+ "Attempting to send payment with payment hash {payment_hash} along path with next hop {first_chan_scid}"
4894
4881
);
4895
4882
4896
4883
let per_peer_state = self.per_peer_state.read().unwrap();
@@ -4924,7 +4911,7 @@ where
4924
4911
};
4925
4912
let send_res = chan.send_htlc_and_commit(
4926
4913
htlc_msat,
4927
- payment_hash.clone() ,
4914
+ * payment_hash,
4928
4915
htlc_cltv,
4929
4916
htlc_source,
4930
4917
onion_packet,
0 commit comments