Skip to content

Commit e7ba103

Browse files
committed
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.
1 parent 2c57878 commit e7ba103

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4195,14 +4195,9 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
41954195

41964196
fn claim_funds_from_hop(&self, channel_state_lock: &mut MutexGuard<ChannelHolder<<K::Target as KeysInterface>::Signer>>, prev_hop: HTLCPreviousHopData, payment_preimage: PaymentPreimage) -> ClaimFundsFromHop {
41974197
//TODO: Delay the claimed_funds relaying just like we do outbound relay!
4198-
let channel_state = &mut **channel_state_lock;
4199-
let chan_id = match self.short_to_chan_info.read().unwrap().get(&prev_hop.short_channel_id) {
4200-
Some((_cp_id, chan_id)) => chan_id.clone(),
4201-
None => {
4202-
return ClaimFundsFromHop::PrevHopForceClosed
4203-
}
4204-
};
42054198

4199+
let chan_id = prev_hop.outpoint.to_channel_id();
4200+
let channel_state = &mut **channel_state_lock;
42064201
if let hash_map::Entry::Occupied(mut chan) = channel_state.by_id.entry(chan_id) {
42074202
match chan.get_mut().get_update_fulfill_htlc_and_commit(prev_hop.htlc_id, payment_preimage, &self.logger) {
42084203
Ok(msgs_monitor_option) => {

0 commit comments

Comments
 (0)