Skip to content

Commit 0325c14

Browse files
committed
f one less closure
1 parent 3a00cd8 commit 0325c14

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

lightning/src/routing/gossip.rs

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2333,29 +2333,26 @@ impl<L: Deref> NetworkGraph<L> where L::Target: Logger {
23332333
if let Some(channel) = channels.get_mut(&msg.short_channel_id) {
23342334
check_msg_sanity(channel)?;
23352335

2336-
let get_new_channel_info = || {
2337-
let last_update_message = if msg.excess_data.len() <= MAX_EXCESS_BYTES_FOR_RELAY
2338-
{ full_msg.cloned() } else { None };
2339-
2340-
let updated_channel_update_info = ChannelUpdateInfo {
2341-
enabled: chan_enabled,
2342-
last_update: msg.timestamp,
2343-
cltv_expiry_delta: msg.cltv_expiry_delta,
2344-
htlc_minimum_msat: msg.htlc_minimum_msat,
2345-
htlc_maximum_msat: msg.htlc_maximum_msat,
2346-
fees: RoutingFees {
2347-
base_msat: msg.fee_base_msat,
2348-
proportional_millionths: msg.fee_proportional_millionths,
2349-
},
2350-
last_update_message
2351-
};
2352-
Some(updated_channel_update_info)
2353-
};
2336+
let last_update_message = if msg.excess_data.len() <= MAX_EXCESS_BYTES_FOR_RELAY
2337+
{ full_msg.cloned() } else { None };
2338+
2339+
let new_channel_info = Some(ChannelUpdateInfo {
2340+
enabled: chan_enabled,
2341+
last_update: msg.timestamp,
2342+
cltv_expiry_delta: msg.cltv_expiry_delta,
2343+
htlc_minimum_msat: msg.htlc_minimum_msat,
2344+
htlc_maximum_msat: msg.htlc_maximum_msat,
2345+
fees: RoutingFees {
2346+
base_msat: msg.fee_base_msat,
2347+
proportional_millionths: msg.fee_proportional_millionths,
2348+
},
2349+
last_update_message
2350+
});
23542351

23552352
if msg.channel_flags & 1 == 1 {
2356-
channel.two_to_one = get_new_channel_info();
2353+
channel.two_to_one = new_channel_info;
23572354
} else {
2358-
channel.one_to_two = get_new_channel_info();
2355+
channel.one_to_two = new_channel_info;
23592356
}
23602357
}
23612358

0 commit comments

Comments
 (0)