Skip to content

Commit 8645e19

Browse files
committed
Add optional last_rapid_gossip_sync_timestamp field to NetworkGraph.
1 parent aac3907 commit 8645e19

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

lightning/src/routing/network_graph.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ pub struct NetworkGraph {
127127
// Lock order: channels -> nodes
128128
channels: RwLock<BTreeMap<u64, ChannelInfo>>,
129129
nodes: RwLock<BTreeMap<NodeId, NodeInfo>>,
130+
last_rapid_gossip_sync_timestamp: Option<u32>,
130131
}
131132

132133
impl Clone for NetworkGraph {
@@ -137,6 +138,7 @@ impl Clone for NetworkGraph {
137138
genesis_hash: self.genesis_hash.clone(),
138139
channels: RwLock::new(channels.clone()),
139140
nodes: RwLock::new(nodes.clone()),
141+
last_rapid_gossip_sync_timestamp: self.last_rapid_gossip_sync_timestamp.clone(),
140142
}
141143
}
142144
}
@@ -990,7 +992,9 @@ impl Writeable for NetworkGraph {
990992
node_info.write(writer)?;
991993
}
992994

993-
write_tlv_fields!(writer, {});
995+
write_tlv_fields!(writer, {
996+
(1, self.last_rapid_gossip_sync_timestamp, option),
997+
});
994998
Ok(())
995999
}
9961000
}
@@ -1014,12 +1018,18 @@ impl Readable for NetworkGraph {
10141018
let node_info = Readable::read(reader)?;
10151019
nodes.insert(node_id, node_info);
10161020
}
1017-
read_tlv_fields!(reader, {});
1021+
1022+
let mut last_rapid_gossip_sync_timestamp: Option<u32> = None;
1023+
1024+
read_tlv_fields!(reader, {
1025+
(1, last_rapid_gossip_sync_timestamp, option),
1026+
});
10181027

10191028
Ok(NetworkGraph {
10201029
genesis_hash,
10211030
channels: RwLock::new(channels),
10221031
nodes: RwLock::new(nodes),
1032+
last_rapid_gossip_sync_timestamp,
10231033
})
10241034
}
10251035
}
@@ -1053,6 +1063,7 @@ impl NetworkGraph {
10531063
genesis_hash,
10541064
channels: RwLock::new(BTreeMap::new()),
10551065
nodes: RwLock::new(BTreeMap::new()),
1066+
last_rapid_gossip_sync_timestamp: None,
10561067
}
10571068
}
10581069

0 commit comments

Comments
 (0)