Skip to content

Commit a0f9b64

Browse files
author
Antoine Riard
committed
More logs in Router
1 parent e5bedc4 commit a0f9b64

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lightning/src/ln/router.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ impl RoutingMessageHandler for Router {
427427
},
428428
None => {},
429429
}
430+
log_trace!(self, "Announced node {}", msg.contents.node_id);
430431

431432
node.features = msg.contents.features.clone();
432433
node.last_update = Some(msg.contents.timestamp);
@@ -555,6 +556,7 @@ impl RoutingMessageHandler for Router {
555556
}
556557
};
557558
}
559+
log_trace!(self, "Announced channel {} between {} and {}", msg.contents.short_channel_id, msg.contents.node_id_1, msg.contents.node_id_2);
558560

559561
add_channel_to_node!(msg.contents.node_id_1);
560562
add_channel_to_node!(msg.contents.node_id_2);
@@ -868,6 +870,7 @@ impl Router {
868870
if let Some(hops) = first_hops {
869871
for chan in hops {
870872
let short_channel_id = chan.short_channel_id.expect("first_hops should be filled in with usable channels, not pending ones");
873+
log_trace!(self, "First hop link {} to {}", chan.short_channel_id.unwrap(), chan.remote_network_id);
871874
if chan.remote_network_id == *target {
872875
return Ok(Route {
873876
hops: vec![RouteHop {
@@ -955,8 +958,11 @@ impl Router {
955958
}
956959
}
957960

961+
log_trace!(self, "Node {} requires {}", $node_id, $node.features.requires_unknown_bits());
958962
if !$node.features.requires_unknown_bits() {
963+
log_trace!(self, "Node {} with {} links", $node_id, $node.channels.len());
959964
for chan_id in $node.channels.iter() {
965+
log_trace!(self, "Adding link {}", chan_id);
960966
let chan = network.channels.get(chan_id).unwrap();
961967
if !chan.features.requires_unknown_bits() {
962968
if chan.one_to_two.src_node_id == *$node_id {
@@ -979,6 +985,7 @@ impl Router {
979985
};
980986
}
981987

988+
log_trace!(self, "Tracing route to {}...", target);
982989
match network.nodes.get(target) {
983990
None => {},
984991
Some(node) => {
@@ -1006,6 +1013,7 @@ impl Router {
10061013
}
10071014

10081015
while let Some(RouteGraphNode { pubkey, lowest_fee_to_node, .. }) = targets.pop() {
1016+
log_trace!(self, "Finding link for destination {}", pubkey);
10091017
if pubkey == network.our_node_id {
10101018
let mut res = vec!(dist.remove(&network.our_node_id).unwrap().3);
10111019
loop {

0 commit comments

Comments
 (0)