From: Matt Corallo Date: Wed, 30 Nov 2022 03:02:27 +0000 (+0000) Subject: Drop useless SCID lookup in `claim_funds_from_hop` X-Git-Tag: v0.0.113~24^2~1 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=e7ba10383b6f925eb26df02bba9b61a31124cc50;p=rust-lightning Drop useless SCID lookup in `claim_funds_from_hop` We have the channel_id available in `prev_hop` so there's no reason to look it up by SCID. --- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 7be667b92..a672d01e8 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -4195,14 +4195,9 @@ impl ChannelManager::Signer>>, prev_hop: HTLCPreviousHopData, payment_preimage: PaymentPreimage) -> ClaimFundsFromHop { //TODO: Delay the claimed_funds relaying just like we do outbound relay! - let channel_state = &mut **channel_state_lock; - let chan_id = match self.short_to_chan_info.read().unwrap().get(&prev_hop.short_channel_id) { - Some((_cp_id, chan_id)) => chan_id.clone(), - None => { - return ClaimFundsFromHop::PrevHopForceClosed - } - }; + let chan_id = prev_hop.outpoint.to_channel_id(); + let channel_state = &mut **channel_state_lock; if let hash_map::Entry::Occupied(mut chan) = channel_state.by_id.entry(chan_id) { match chan.get_mut().get_update_fulfill_htlc_and_commit(prev_hop.htlc_id, payment_preimage, &self.logger) { Ok(msgs_monitor_option) => {