From b22519c0f92a2d581bc637ffd127ae28700ec9f2 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 28 Jul 2018 17:39:33 -0400 Subject: [PATCH] Some match -> if let replacement --- src/ln/channelmanager.rs | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/ln/channelmanager.rs b/src/ln/channelmanager.rs index 707a262b1..b1013ad12 100644 --- a/src/ln/channelmanager.rs +++ b/src/ln/channelmanager.rs @@ -1624,20 +1624,14 @@ impl ChannelMessageHandler for ChannelManager { // destination. That's OK since those nodes are probably busted or trying to do network // mapping through repeated loops. In either case, we want them to stop talking to us, so // we send permanent_node_failure. - match &claimable_htlcs_entry { - &hash_map::Entry::Occupied(ref e) => { - let mut acceptable_cycle = false; - match e.get() { - &PendingOutboundHTLC::OutboundRoute { .. } => { - acceptable_cycle = pending_forward_info.short_channel_id == 0; - }, - _ => {}, - } - if !acceptable_cycle { - return_err!("Payment looped through us twice", 0x4000 | 0x2000 | 2, &[0;0]); - } - }, - _ => {}, + if let &hash_map::Entry::Occupied(ref e) = &claimable_htlcs_entry { + let mut acceptable_cycle = false; + if let &PendingOutboundHTLC::OutboundRoute { .. } = e.get() { + acceptable_cycle = pending_forward_info.short_channel_id == 0; + } + if !acceptable_cycle { + return_err!("Payment looped through us twice", 0x4000 | 0x2000 | 2, &[0;0]); + } } let (source_short_channel_id, res) = match channel_state.by_id.get_mut(&msg.channel_id) { -- 2.39.5