Skip to content

Commit cff4c6d

Browse files
committed
Add unit test for last_rapid_gossip_sync_timestamp field [de]serialization.
1 parent 8645e19 commit cff4c6d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lightning/src/routing/network_graph.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2370,6 +2370,18 @@ mod tests {
23702370
assert!(<NetworkGraph>::read(&mut io::Cursor::new(&w.0)).unwrap() == network_graph);
23712371
}
23722372

2373+
#[test]
2374+
fn network_graph_tlv_serialization() {
2375+
let mut network_graph = create_network_graph();
2376+
network_graph.last_rapid_gossip_sync_timestamp.replace(42);
2377+
2378+
let mut w = test_utils::TestVecWriter(Vec::new());
2379+
network_graph.write(&mut w).unwrap();
2380+
let reassembled_network_graph: NetworkGraph = Readable::read(&mut io::Cursor::new(&w.0)).unwrap();
2381+
assert!(reassembled_network_graph == network_graph);
2382+
assert_eq!(reassembled_network_graph.last_rapid_gossip_sync_timestamp.unwrap(), 42);
2383+
}
2384+
23732385
#[test]
23742386
#[cfg(feature = "std")]
23752387
fn calling_sync_routing_table() {

0 commit comments

Comments
 (0)