Skip to content

Commit 2243ba3

Browse files
committed
Improve network graph update logging.
1 parent a24626b commit 2243ba3

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

lightning/src/routing/gossip.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,6 +1553,8 @@ impl<L: Deref> NetworkGraph<L> where L::Target: Logger {
15531553
let node_id_a = channel_info.node_one.clone();
15541554
let node_id_b = channel_info.node_two.clone();
15551555

1556+
log_gossip!(self.logger, "Adding channel {} between nodes {} and {}", short_channel_id, node_id_a, node_id_b);
1557+
15561558
match channels.entry(short_channel_id) {
15571559
IndexedMapEntry::Occupied(mut entry) => {
15581560
//TODO: because asking the blockchain if short_channel_id is valid is only optional
@@ -1787,17 +1789,26 @@ impl<L: Deref> NetworkGraph<L> where L::Target: Logger {
17871789
// time.
17881790
let mut scids_to_remove = Vec::new();
17891791
for (scid, info) in channels.unordered_iter_mut() {
1790-
if info.one_to_two.is_some() && info.one_to_two.as_ref().unwrap().last_update < min_time_unix {
1792+
let one_to_two_update_timestamp = info.one_to_two.as_ref().unwrap().last_update;
1793+
let two_to_one_update_timestamp = info.two_to_one.as_ref().unwrap().last_update;
1794+
if info.one_to_two.is_some() && one_to_two_update_timestamp < min_time_unix {
1795+
log_gossip!(self.logger, "Removing directional update one_to_two (0) for channel {} due to its timestamp {} being below {}",
1796+
scid, one_to_two_update_timestamp, min_time_unix);
17911797
info.one_to_two = None;
17921798
}
1793-
if info.two_to_one.is_some() && info.two_to_one.as_ref().unwrap().last_update < min_time_unix {
1799+
if info.two_to_one.is_some() && two_to_one_update_timestamp < min_time_unix {
1800+
log_gossip!(self.logger, "Removing directional update two_to_one (1) for channel {} due to its timestamp {} being below {}",
1801+
scid, two_to_one_update_timestamp, min_time_unix);
17941802
info.two_to_one = None;
17951803
}
17961804
if info.one_to_two.is_none() || info.two_to_one.is_none() {
17971805
// We check the announcement_received_time here to ensure we don't drop
17981806
// announcements that we just received and are just waiting for our peer to send a
17991807
// channel_update for.
1800-
if info.announcement_received_time < min_time_unix as u64 {
1808+
let announcement_received_timestamp = info.announcement_received_time;
1809+
if announcement_received_timestamp < min_time_unix as u64 {
1810+
log_gossip!(self.logger, "Removing channel {} because both directional updates are missing and its announcement timestamp {} being below {}",
1811+
scid, announcement_received_timestamp, min_time_unix);
18011812
scids_to_remove.push(*scid);
18021813
}
18031814
}
@@ -1878,6 +1889,8 @@ impl<L: Deref> NetworkGraph<L> where L::Target: Logger {
18781889
}
18791890
}
18801891

1892+
log_gossip!(self.logger, "Updating channel {} in direction {}", msg.short_channel_id, msg.flags & 1);
1893+
18811894
let mut channels = self.channels.write().unwrap();
18821895
match channels.get_mut(&msg.short_channel_id) {
18831896
None => {

0 commit comments

Comments
 (0)