Skip to content

Commit b22519c

Browse files
committed
Some match -> if let replacement
1 parent fb9f169 commit b22519c

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

src/ln/channelmanager.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,20 +1624,14 @@ impl ChannelMessageHandler for ChannelManager {
16241624
// destination. That's OK since those nodes are probably busted or trying to do network
16251625
// mapping through repeated loops. In either case, we want them to stop talking to us, so
16261626
// we send permanent_node_failure.
1627-
match &claimable_htlcs_entry {
1628-
&hash_map::Entry::Occupied(ref e) => {
1629-
let mut acceptable_cycle = false;
1630-
match e.get() {
1631-
&PendingOutboundHTLC::OutboundRoute { .. } => {
1632-
acceptable_cycle = pending_forward_info.short_channel_id == 0;
1633-
},
1634-
_ => {},
1635-
}
1636-
if !acceptable_cycle {
1637-
return_err!("Payment looped through us twice", 0x4000 | 0x2000 | 2, &[0;0]);
1638-
}
1639-
},
1640-
_ => {},
1627+
if let &hash_map::Entry::Occupied(ref e) = &claimable_htlcs_entry {
1628+
let mut acceptable_cycle = false;
1629+
if let &PendingOutboundHTLC::OutboundRoute { .. } = e.get() {
1630+
acceptable_cycle = pending_forward_info.short_channel_id == 0;
1631+
}
1632+
if !acceptable_cycle {
1633+
return_err!("Payment looped through us twice", 0x4000 | 0x2000 | 2, &[0;0]);
1634+
}
16411635
}
16421636

16431637
let (source_short_channel_id, res) = match channel_state.by_id.get_mut(&msg.channel_id) {

0 commit comments

Comments
 (0)