Skip to content

Commit 7819cbd

Browse files
committed
f cleanups
1 parent b985859 commit 7819cbd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lightning/src/routing/network_graph.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ impl NetworkGraph {
13771377
}
13781378
}
13791379
macro_rules! check_update_latest {
1380-
( $target: expr, $src_node: expr) => {
1380+
($target: expr) => {
13811381
if let Some(existing_chan_info) = $target.as_ref() {
13821382
// The timestamp field is somewhat of a misnomer - the BOLTs use it to
13831383
// order updates to ensure you always have the latest one, only
@@ -1397,8 +1397,8 @@ impl NetworkGraph {
13971397
}
13981398
}
13991399

1400-
macro_rules! maybe_update_channel_info {
1401-
( $target: expr, $src_node: expr) => {
1400+
macro_rules! get_new_channel_info {
1401+
() => {
14021402
let last_update_message = if msg.excess_data.len() <= MAX_EXCESS_BYTES_FOR_RELAY
14031403
{ full_msg.cloned() } else { None };
14041404

@@ -1414,31 +1414,31 @@ impl NetworkGraph {
14141414
},
14151415
last_update_message
14161416
};
1417-
$target = Some(updated_channel_update_info);
1417+
Some(updated_channel_update_info);
14181418
}
14191419
}
14201420

14211421
let msg_hash = hash_to_message!(&Sha256dHash::hash(&msg.encode()[..])[..]);
14221422
if msg.flags & 1 == 1 {
14231423
dest_node_id = channel.node_one.clone();
1424-
check_update_latest!(channel.two_to_one, channel.node_two);
1424+
check_update_latest!(channel.two_to_one);
14251425
if let Some((sig, ctx)) = sig_info {
14261426
secp_verify_sig!(ctx, &msg_hash, &sig, &PublicKey::from_slice(channel.node_two.as_slice()).map_err(|_| LightningError{
14271427
err: "Couldn't parse source node pubkey".to_owned(),
14281428
action: ErrorAction::IgnoreAndLog(Level::Debug)
14291429
})?, "channel_update");
14301430
}
1431-
maybe_update_channel_info!(channel.two_to_one, channel.node_two);
1431+
channel.two_to_one = get_new_channel_info!();
14321432
} else {
14331433
dest_node_id = channel.node_two.clone();
1434-
check_update_latest!(channel.one_to_two, channel.node_one);
1434+
check_update_latest!(channel.one_to_two);
14351435
if let Some((sig, ctx)) = sig_info {
14361436
secp_verify_sig!(ctx, &msg_hash, &sig, &PublicKey::from_slice(channel.node_one.as_slice()).map_err(|_| LightningError{
14371437
err: "Couldn't parse destination node pubkey".to_owned(),
14381438
action: ErrorAction::IgnoreAndLog(Level::Debug)
14391439
})?, "channel_update");
14401440
}
1441-
maybe_update_channel_info!(channel.one_to_two, channel.node_one);
1441+
channel.one_to_two = get_new_channel_info!();
14421442
}
14431443
}
14441444
}

0 commit comments

Comments
 (0)