Skip to content

Commit 1845f4b

Browse files
committed
update announcement processing to take stripped inputs
1 parent 73cd366 commit 1845f4b

File tree

5 files changed

+238
-166
lines changed

5 files changed

+238
-166
lines changed

lightning-graph-sync/README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,23 @@ Essentially, the serialization structure is as follows:
1414
1. Fixed prefix bytes `76, 68, 75, 2` (the first three bytes are ASCII for `LDK`)
1515
- The purpose of this prefix is to identify the serialization format, should other
1616
rapid gossip sync formats arise in the future
17-
2. A `CompactSize` indicating the number of `ChannelAnnouncement` messages to follow
18-
3. `[ChannelAnnouncement]` (array of almost BOLT-7-compliant channel announcements,
19-
with the distinction that the signatures are stripped)
20-
4. A `CompactSize` indicating the number of channel update messages to follow`
17+
2. A `CompactSize` indicating the number of channel announcement messages to follow
18+
3. `[CustomChannelAnnouncement]` (array of significantly stripped down channel announcements)
19+
4. A `CompactSize` indicating the number of channel update messages to follow
2120
5. `[CustomChannelUpdate]`
2221

22+
You will also notice that `NodeAnnouncement` messages are skipped altogether.
23+
24+
### CustomChannelAnnouncements
25+
26+
To achieve compactness and avoid data repetition, we're sending a significantly stripped down version of the
27+
channel announcement message, which contains only the following data:
28+
29+
1. `channel_features`: `u16` + `n`, where `n` is the number of bytes indicated by the first `u16`
30+
2. `short_channel_id`: `u64`
31+
3. `node_id_1`: `ECPoint`
32+
4. `node_id_2`: `ECPoint`
33+
2334
### CustomChannelUpdate
2435

2536
For the purpose of rapid syncing, we have deviated from the channel update format

lightning-graph-sync/src/lib.rs

Lines changed: 131 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ mod tests {
8686
"{}\r\n\
8787
Content-Length: {}\r\n\
8888
\r\n\
89-
", status, data.len()).as_bytes().to_vec();
89+
",
90+
status,
91+
data.len()
92+
)
93+
.as_bytes()
94+
.to_vec();
9095
response_bytes.extend_from_slice(data);
9196
HttpServer::responding_with(response_bytes)
9297
}
@@ -108,30 +113,43 @@ mod tests {
108113
let handler = std::thread::spawn(move || {
109114
for stream in listener.incoming() {
110115
let mut stream = stream.unwrap();
111-
stream.set_write_timeout(Some(Duration::from_secs(5))).unwrap();
116+
stream
117+
.set_write_timeout(Some(Duration::from_secs(5)))
118+
.unwrap();
112119

113120
let lines_read = std::io::BufReader::new(&stream)
114121
.lines()
115122
.take_while(|line| !line.as_ref().unwrap().is_empty())
116123
.count();
117-
if lines_read == 0 { continue; }
124+
if lines_read == 0 {
125+
continue;
126+
}
118127

119128
for chunk in response_bytes.chunks(16) {
120129
if shutdown_signaled.load(std::sync::atomic::Ordering::SeqCst) {
121130
return;
122131
} else {
123-
if let Err(_) = stream.write(chunk) { break; }
124-
if let Err(_) = stream.flush() { break; }
132+
if let Err(_) = stream.write(chunk) {
133+
break;
134+
}
135+
if let Err(_) = stream.flush() {
136+
break;
137+
}
125138
}
126139
}
127140
}
128141
});
129142

130-
Self { address, handler, shutdown }
143+
Self {
144+
address,
145+
handler,
146+
shutdown,
147+
}
131148
}
132149

133150
fn shutdown(self) {
134-
self.shutdown.store(true, std::sync::atomic::Ordering::SeqCst);
151+
self.shutdown
152+
.store(true, std::sync::atomic::Ordering::SeqCst);
135153
self.handler.join().unwrap();
136154
}
137155

@@ -143,17 +161,66 @@ mod tests {
143161

144162
#[tokio::test]
145163
async fn test_mock_endpoint_fidelity() {
146-
let valid_response = vec![76, 68, 75, 2, 2, 174, 0, 0, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247, 79, 147, 30, 131, 101, 225, 90, 8, 156, 104, 214, 25, 0, 0, 0, 0, 0, 8, 153, 192, 0, 2, 27, 0, 0, 2, 22, 7, 207, 206, 25, 164, 197, 231, 230, 231, 56, 102, 61, 250, 251, 187, 172, 38, 46, 79, 247, 108, 44, 155, 48, 219, 238, 252, 53, 192, 6, 67, 2, 36, 125, 157, 176, 223, 175, 234, 116, 94, 248, 201, 225, 97, 235, 50, 47, 115, 172, 63, 136, 88, 216, 115, 11, 111, 217, 114, 84, 116, 124, 231, 107, 2, 163, 216, 116, 204, 120, 152, 52, 172, 208, 143, 140, 71, 242, 209, 153, 111, 23, 61, 222, 28, 106, 198, 149, 87, 166, 201, 180, 51, 64, 252, 143, 166, 2, 57, 240, 15, 230, 190, 255, 224, 70, 176, 137, 155, 249, 125, 20, 170, 114, 97, 221, 142, 89, 231, 233, 205, 126, 199, 216, 149, 155, 0, 210, 45, 67, 174, 0, 0, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247, 79, 147, 30, 131, 101, 225, 90, 8, 156, 104, 214, 25, 0, 0, 0, 0, 0, 10, 222, 162, 0, 8, 38, 0, 1, 2, 158, 1, 242, 121, 152, 106, 204, 131, 186, 35, 93, 70, 216, 10, 237, 224, 183, 89, 95, 65, 3, 83, 185, 58, 138, 181, 64, 187, 103, 127, 68, 50, 2, 201, 19, 17, 138, 136, 149, 185, 226, 156, 137, 175, 110, 32, 237, 0, 217, 90, 31, 100, 228, 149, 46, 219, 175, 168, 77, 4, 143, 38, 128, 76, 97, 2, 155, 9, 173, 229, 75, 82, 137, 57, 21, 112, 207, 99, 92, 145, 58, 48, 229, 10, 228, 163, 3, 106, 147, 39, 177, 90, 242, 186, 249, 11, 210, 54, 2, 212, 16, 225, 46, 42, 209, 254, 11, 28, 254, 196, 167, 139, 164, 241, 7, 176, 120, 192, 199, 148, 152, 38, 17, 118, 41, 122, 240, 223, 249, 158, 145, 2, 8, 153, 192, 0, 2, 27, 0, 0, 1, 27, 1, 0, 40, 0, 0, 0, 0, 0, 0, 3, 232, 0, 0, 0, 1, 0, 0, 0, 125, 0, 0, 0, 0, 58, 85, 116, 216, 10, 222, 162, 0, 8, 38, 0, 1, 1, 27, 1, 0, 40, 0, 0, 0, 0, 0, 0, 3, 232, 0, 0, 3, 232, 0, 0, 0, 1, 0, 0, 0, 0, 29, 129, 25, 192];
164+
let valid_response = vec![
165+
76, 68, 75, 2, 2, 174, 0, 0, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70,
166+
174, 99, 247, 79, 147, 30, 131, 101, 225, 90, 8, 156, 104, 214, 25, 0, 0, 0, 0, 0, 8,
167+
153, 192, 0, 2, 27, 0, 0, 2, 22, 7, 207, 206, 25, 164, 197, 231, 230, 231, 56, 102, 61,
168+
250, 251, 187, 172, 38, 46, 79, 247, 108, 44, 155, 48, 219, 238, 252, 53, 192, 6, 67,
169+
2, 36, 125, 157, 176, 223, 175, 234, 116, 94, 248, 201, 225, 97, 235, 50, 47, 115, 172,
170+
63, 136, 88, 216, 115, 11, 111, 217, 114, 84, 116, 124, 231, 107, 2, 163, 216, 116,
171+
204, 120, 152, 52, 172, 208, 143, 140, 71, 242, 209, 153, 111, 23, 61, 222, 28, 106,
172+
198, 149, 87, 166, 201, 180, 51, 64, 252, 143, 166, 2, 57, 240, 15, 230, 190, 255, 224,
173+
70, 176, 137, 155, 249, 125, 20, 170, 114, 97, 221, 142, 89, 231, 233, 205, 126, 199,
174+
216, 149, 155, 0, 210, 45, 67, 174, 0, 0, 111, 226, 140, 10, 182, 241, 179, 114, 193,
175+
166, 162, 70, 174, 99, 247, 79, 147, 30, 131, 101, 225, 90, 8, 156, 104, 214, 25, 0, 0,
176+
0, 0, 0, 10, 222, 162, 0, 8, 38, 0, 1, 2, 158, 1, 242, 121, 152, 106, 204, 131, 186,
177+
35, 93, 70, 216, 10, 237, 224, 183, 89, 95, 65, 3, 83, 185, 58, 138, 181, 64, 187, 103,
178+
127, 68, 50, 2, 201, 19, 17, 138, 136, 149, 185, 226, 156, 137, 175, 110, 32, 237, 0,
179+
217, 90, 31, 100, 228, 149, 46, 219, 175, 168, 77, 4, 143, 38, 128, 76, 97, 2, 155, 9,
180+
173, 229, 75, 82, 137, 57, 21, 112, 207, 99, 92, 145, 58, 48, 229, 10, 228, 163, 3,
181+
106, 147, 39, 177, 90, 242, 186, 249, 11, 210, 54, 2, 212, 16, 225, 46, 42, 209, 254,
182+
11, 28, 254, 196, 167, 139, 164, 241, 7, 176, 120, 192, 199, 148, 152, 38, 17, 118, 41,
183+
122, 240, 223, 249, 158, 145, 2, 8, 153, 192, 0, 2, 27, 0, 0, 1, 27, 1, 0, 40, 0, 0, 0,
184+
0, 0, 0, 3, 232, 0, 0, 0, 1, 0, 0, 0, 125, 0, 0, 0, 0, 58, 85, 116, 216, 10, 222, 162,
185+
0, 8, 38, 0, 1, 1, 27, 1, 0, 40, 0, 0, 0, 0, 0, 0, 3, 232, 0, 0, 3, 232, 0, 0, 0, 1, 0,
186+
0, 0, 0, 29, 129, 25, 192,
187+
];
147188
let server = HttpServer::responding_with_ok(&valid_response[..]);
148189

149190
let mut client = HttpClient::connect(&server.endpoint()).unwrap();
150-
let binary_response = client.get::<BinaryResponse>("/foo", "foo.com").await.unwrap();
191+
let binary_response = client
192+
.get::<BinaryResponse>("/foo", "foo.com")
193+
.await
194+
.unwrap();
151195
assert_eq!(binary_response.0, valid_response);
152196
}
153197

154198
#[tokio::test]
155199
async fn http_sync_fails_on_server_error() {
156-
let valid_response = vec![76, 68, 75, 2, 2, 174, 0, 0, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247, 79, 147, 30, 131, 101, 225, 90, 8, 156, 104, 214, 25, 0, 0, 0, 0, 0, 8, 153, 192, 0, 2, 27, 0, 0, 2, 22, 7, 207, 206, 25, 164, 197, 231, 230, 231, 56, 102, 61, 250, 251, 187, 172, 38, 46, 79, 247, 108, 44, 155, 48, 219, 238, 252, 53, 192, 6, 67, 2, 36, 125, 157, 176, 223, 175, 234, 116, 94, 248, 201, 225, 97, 235, 50, 47, 115, 172, 63, 136, 88, 216, 115, 11, 111, 217, 114, 84, 116, 124, 231, 107, 2, 163, 216, 116, 204, 120, 152, 52, 172, 208, 143, 140, 71, 242, 209, 153, 111, 23, 61, 222, 28, 106, 198, 149, 87, 166, 201, 180, 51, 64, 252, 143, 166, 2, 57, 240, 15, 230, 190, 255, 224, 70, 176, 137, 155, 249, 125, 20, 170, 114, 97, 221, 142, 89, 231, 233, 205, 126, 199, 216, 149, 155, 0, 210, 45, 67, 174, 0, 0, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247, 79, 147, 30, 131, 101, 225, 90, 8, 156, 104, 214, 25, 0, 0, 0, 0, 0, 10, 222, 162, 0, 8, 38, 0, 1, 2, 158, 1, 242, 121, 152, 106, 204, 131, 186, 35, 93, 70, 216, 10, 237, 224, 183, 89, 95, 65, 3, 83, 185, 58, 138, 181, 64, 187, 103, 127, 68, 50, 2, 201, 19, 17, 138, 136, 149, 185, 226, 156, 137, 175, 110, 32, 237, 0, 217, 90, 31, 100, 228, 149, 46, 219, 175, 168, 77, 4, 143, 38, 128, 76, 97, 2, 155, 9, 173, 229, 75, 82, 137, 57, 21, 112, 207, 99, 92, 145, 58, 48, 229, 10, 228, 163, 3, 106, 147, 39, 177, 90, 242, 186, 249, 11, 210, 54, 2, 212, 16, 225, 46, 42, 209, 254, 11, 28, 254, 196, 167, 139, 164, 241, 7, 176, 120, 192, 199, 148, 152, 38, 17, 118, 41, 122, 240, 223, 249, 158, 145, 2, 8, 153, 192, 0, 2, 27, 0, 0, 1, 27, 1, 0, 40, 0, 0, 0, 0, 0, 0, 3, 232, 0, 0, 0, 1, 0, 0, 0, 125, 0, 0, 0, 0, 58, 85, 116, 216, 10, 222, 162, 0, 8, 38, 0, 1, 1, 27, 1, 0, 40, 0, 0, 0, 0, 0, 0, 3, 232, 0, 0, 3, 232, 0, 0, 0, 1, 0, 0, 0, 0, 29, 129, 25, 192];
200+
let valid_response = vec![
201+
76, 68, 75, 2, 2, 174, 0, 0, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70,
202+
174, 99, 247, 79, 147, 30, 131, 101, 225, 90, 8, 156, 104, 214, 25, 0, 0, 0, 0, 0, 8,
203+
153, 192, 0, 2, 27, 0, 0, 2, 22, 7, 207, 206, 25, 164, 197, 231, 230, 231, 56, 102, 61,
204+
250, 251, 187, 172, 38, 46, 79, 247, 108, 44, 155, 48, 219, 238, 252, 53, 192, 6, 67,
205+
2, 36, 125, 157, 176, 223, 175, 234, 116, 94, 248, 201, 225, 97, 235, 50, 47, 115, 172,
206+
63, 136, 88, 216, 115, 11, 111, 217, 114, 84, 116, 124, 231, 107, 2, 163, 216, 116,
207+
204, 120, 152, 52, 172, 208, 143, 140, 71, 242, 209, 153, 111, 23, 61, 222, 28, 106,
208+
198, 149, 87, 166, 201, 180, 51, 64, 252, 143, 166, 2, 57, 240, 15, 230, 190, 255, 224,
209+
70, 176, 137, 155, 249, 125, 20, 170, 114, 97, 221, 142, 89, 231, 233, 205, 126, 199,
210+
216, 149, 155, 0, 210, 45, 67, 174, 0, 0, 111, 226, 140, 10, 182, 241, 179, 114, 193,
211+
166, 162, 70, 174, 99, 247, 79, 147, 30, 131, 101, 225, 90, 8, 156, 104, 214, 25, 0, 0,
212+
0, 0, 0, 10, 222, 162, 0, 8, 38, 0, 1, 2, 158, 1, 242, 121, 152, 106, 204, 131, 186,
213+
35, 93, 70, 216, 10, 237, 224, 183, 89, 95, 65, 3, 83, 185, 58, 138, 181, 64, 187, 103,
214+
127, 68, 50, 2, 201, 19, 17, 138, 136, 149, 185, 226, 156, 137, 175, 110, 32, 237, 0,
215+
217, 90, 31, 100, 228, 149, 46, 219, 175, 168, 77, 4, 143, 38, 128, 76, 97, 2, 155, 9,
216+
173, 229, 75, 82, 137, 57, 21, 112, 207, 99, 92, 145, 58, 48, 229, 10, 228, 163, 3,
217+
106, 147, 39, 177, 90, 242, 186, 249, 11, 210, 54, 2, 212, 16, 225, 46, 42, 209, 254,
218+
11, 28, 254, 196, 167, 139, 164, 241, 7, 176, 120, 192, 199, 148, 152, 38, 17, 118, 41,
219+
122, 240, 223, 249, 158, 145, 2, 8, 153, 192, 0, 2, 27, 0, 0, 1, 27, 1, 0, 40, 0, 0, 0,
220+
0, 0, 0, 3, 232, 0, 0, 0, 1, 0, 0, 0, 125, 0, 0, 0, 0, 58, 85, 116, 216, 10, 222, 162,
221+
0, 8, 38, 0, 1, 1, 27, 1, 0, 40, 0, 0, 0, 0, 0, 0, 3, 232, 0, 0, 3, 232, 0, 0, 0, 1, 0,
222+
0, 0, 0, 29, 129, 25, 192,
223+
];
157224
let server = HttpServer::responding_with_server_error(&valid_response[..]);
158225

159226
let block_hash = genesis_block(Network::Bitcoin).block_hash();
@@ -186,7 +253,19 @@ mod tests {
186253

187254
#[tokio::test]
188255
async fn test_http_request() {
189-
let valid_response = vec![76, 68, 75, 2, 2, 174, 0, 0, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247, 79, 147, 30, 131, 101, 225, 90, 8, 156, 104, 214, 25, 0, 0, 0, 0, 0, 8, 153, 192, 0, 2, 27, 0, 0, 2, 22, 7, 207, 206, 25, 164, 197, 231, 230, 231, 56, 102, 61, 250, 251, 187, 172, 38, 46, 79, 247, 108, 44, 155, 48, 219, 238, 252, 53, 192, 6, 67, 2, 36, 125, 157, 176, 223, 175, 234, 116, 94, 248, 201, 225, 97, 235, 50, 47, 115, 172, 63, 136, 88, 216, 115, 11, 111, 217, 114, 84, 116, 124, 231, 107, 2, 163, 216, 116, 204, 120, 152, 52, 172, 208, 143, 140, 71, 242, 209, 153, 111, 23, 61, 222, 28, 106, 198, 149, 87, 166, 201, 180, 51, 64, 252, 143, 166, 2, 57, 240, 15, 230, 190, 255, 224, 70, 176, 137, 155, 249, 125, 20, 170, 114, 97, 221, 142, 89, 231, 233, 205, 126, 199, 216, 149, 155, 0, 210, 45, 67, 174, 0, 0, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247, 79, 147, 30, 131, 101, 225, 90, 8, 156, 104, 214, 25, 0, 0, 0, 0, 0, 10, 222, 162, 0, 8, 38, 0, 1, 2, 158, 1, 242, 121, 152, 106, 204, 131, 186, 35, 93, 70, 216, 10, 237, 224, 183, 89, 95, 65, 3, 83, 185, 58, 138, 181, 64, 187, 103, 127, 68, 50, 2, 201, 19, 17, 138, 136, 149, 185, 226, 156, 137, 175, 110, 32, 237, 0, 217, 90, 31, 100, 228, 149, 46, 219, 175, 168, 77, 4, 143, 38, 128, 76, 97, 2, 155, 9, 173, 229, 75, 82, 137, 57, 21, 112, 207, 99, 92, 145, 58, 48, 229, 10, 228, 163, 3, 106, 147, 39, 177, 90, 242, 186, 249, 11, 210, 54, 2, 212, 16, 225, 46, 42, 209, 254, 11, 28, 254, 196, 167, 139, 164, 241, 7, 176, 120, 192, 199, 148, 152, 38, 17, 118, 41, 122, 240, 223, 249, 158, 145, 2, 8, 153, 192, 0, 2, 27, 0, 0, 1, 27, 1, 0, 40, 0, 0, 0, 0, 0, 0, 3, 232, 0, 0, 0, 1, 0, 0, 0, 125, 0, 0, 0, 0, 58, 85, 116, 216, 10, 222, 162, 0, 8, 38, 0, 1, 1, 27, 1, 0, 40, 0, 0, 0, 0, 0, 0, 3, 232, 0, 0, 3, 232, 0, 0, 0, 1, 0, 0, 0, 0, 29, 129, 25, 192];
256+
let valid_response = vec![
257+
76, 68, 75, 2, 2, 0, 0, 8, 153, 192, 0, 2, 27, 0, 0, 2, 22, 7, 207, 206, 25, 164, 197,
258+
231, 230, 231, 56, 102, 61, 250, 251, 187, 172, 38, 46, 79, 247, 108, 44, 155, 48, 219,
259+
238, 252, 53, 192, 6, 67, 2, 36, 125, 157, 176, 223, 175, 234, 116, 94, 248, 201, 225,
260+
97, 235, 50, 47, 115, 172, 63, 136, 88, 216, 115, 11, 111, 217, 114, 84, 116, 124, 231,
261+
107, 0, 0, 10, 222, 162, 0, 8, 38, 0, 1, 2, 158, 1, 242, 121, 152, 106, 204, 131, 186,
262+
35, 93, 70, 216, 10, 237, 224, 183, 89, 95, 65, 3, 83, 185, 58, 138, 181, 64, 187, 103,
263+
127, 68, 50, 2, 201, 19, 17, 138, 136, 149, 185, 226, 156, 137, 175, 110, 32, 237, 0,
264+
217, 90, 31, 100, 228, 149, 46, 219, 175, 168, 77, 4, 143, 38, 128, 76, 97, 2, 8, 153,
265+
192, 0, 2, 27, 0, 0, 1, 27, 1, 0, 40, 0, 0, 0, 0, 0, 0, 3, 232, 0, 0, 0, 1, 0, 0, 0,
266+
125, 0, 0, 0, 0, 58, 85, 116, 216, 10, 222, 162, 0, 8, 38, 0, 1, 1, 27, 1, 0, 40, 0, 0,
267+
0, 0, 0, 0, 3, 232, 0, 0, 3, 232, 0, 0, 0, 1, 0, 0, 0, 0, 29, 129, 25, 192,
268+
];
190269
let server = HttpServer::responding_with_ok(&valid_response[..]);
191270

192271
let block_hash = genesis_block(Network::Bitcoin).block_hash();
@@ -218,17 +297,37 @@ mod tests {
218297

219298
let after = network_graph.to_string();
220299
assert_eq!(after.len(), 1737);
221-
assert!(after.contains("021607cfce19a4c5e7e6e738663dfafbbbac262e4ff76c2c9b30dbeefc35c00643:"));
222-
assert!(after.contains("02247d9db0dfafea745ef8c9e161eb322f73ac3f8858d8730b6fd97254747ce76b:"));
223-
assert!(after.contains("029e01f279986acc83ba235d46d80aede0b7595f410353b93a8ab540bb677f4432:"));
224-
assert!(after.contains("02c913118a8895b9e29c89af6e20ed00d95a1f64e4952edbafa84d048f26804c61:"));
300+
assert!(
301+
after.contains("021607cfce19a4c5e7e6e738663dfafbbbac262e4ff76c2c9b30dbeefc35c00643:")
302+
);
303+
assert!(
304+
after.contains("02247d9db0dfafea745ef8c9e161eb322f73ac3f8858d8730b6fd97254747ce76b:")
305+
);
306+
assert!(
307+
after.contains("029e01f279986acc83ba235d46d80aede0b7595f410353b93a8ab540bb677f4432:")
308+
);
309+
assert!(
310+
after.contains("02c913118a8895b9e29c89af6e20ed00d95a1f64e4952edbafa84d048f26804c61:")
311+
);
225312
assert!(after.contains("channels: [619737530008010752]"));
226313
assert!(after.contains("channels: [783241506229452801]"));
227314
}
228315

229316
#[test]
230317
fn test_sync_from_file() {
231-
let valid_response = vec![76, 68, 75, 2, 2, 174, 0, 0, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247, 79, 147, 30, 131, 101, 225, 90, 8, 156, 104, 214, 25, 0, 0, 0, 0, 0, 8, 153, 192, 0, 2, 27, 0, 0, 2, 22, 7, 207, 206, 25, 164, 197, 231, 230, 231, 56, 102, 61, 250, 251, 187, 172, 38, 46, 79, 247, 108, 44, 155, 48, 219, 238, 252, 53, 192, 6, 67, 2, 36, 125, 157, 176, 223, 175, 234, 116, 94, 248, 201, 225, 97, 235, 50, 47, 115, 172, 63, 136, 88, 216, 115, 11, 111, 217, 114, 84, 116, 124, 231, 107, 2, 163, 216, 116, 204, 120, 152, 52, 172, 208, 143, 140, 71, 242, 209, 153, 111, 23, 61, 222, 28, 106, 198, 149, 87, 166, 201, 180, 51, 64, 252, 143, 166, 2, 57, 240, 15, 230, 190, 255, 224, 70, 176, 137, 155, 249, 125, 20, 170, 114, 97, 221, 142, 89, 231, 233, 205, 126, 199, 216, 149, 155, 0, 210, 45, 67, 174, 0, 0, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247, 79, 147, 30, 131, 101, 225, 90, 8, 156, 104, 214, 25, 0, 0, 0, 0, 0, 10, 222, 162, 0, 8, 38, 0, 1, 2, 158, 1, 242, 121, 152, 106, 204, 131, 186, 35, 93, 70, 216, 10, 237, 224, 183, 89, 95, 65, 3, 83, 185, 58, 138, 181, 64, 187, 103, 127, 68, 50, 2, 201, 19, 17, 138, 136, 149, 185, 226, 156, 137, 175, 110, 32, 237, 0, 217, 90, 31, 100, 228, 149, 46, 219, 175, 168, 77, 4, 143, 38, 128, 76, 97, 2, 155, 9, 173, 229, 75, 82, 137, 57, 21, 112, 207, 99, 92, 145, 58, 48, 229, 10, 228, 163, 3, 106, 147, 39, 177, 90, 242, 186, 249, 11, 210, 54, 2, 212, 16, 225, 46, 42, 209, 254, 11, 28, 254, 196, 167, 139, 164, 241, 7, 176, 120, 192, 199, 148, 152, 38, 17, 118, 41, 122, 240, 223, 249, 158, 145, 2, 8, 153, 192, 0, 2, 27, 0, 0, 1, 27, 1, 0, 40, 0, 0, 0, 0, 0, 0, 3, 232, 0, 0, 0, 1, 0, 0, 0, 125, 0, 0, 0, 0, 58, 85, 116, 216, 10, 222, 162, 0, 8, 38, 0, 1, 1, 27, 1, 0, 40, 0, 0, 0, 0, 0, 0, 3, 232, 0, 0, 3, 232, 0, 0, 0, 1, 0, 0, 0, 0, 29, 129, 25, 192];
318+
let valid_response = vec![
319+
76, 68, 75, 2, 2, 0, 0, 8, 153, 192, 0, 2, 27, 0, 0, 2, 22, 7, 207, 206, 25, 164, 197,
320+
231, 230, 231, 56, 102, 61, 250, 251, 187, 172, 38, 46, 79, 247, 108, 44, 155, 48, 219,
321+
238, 252, 53, 192, 6, 67, 2, 36, 125, 157, 176, 223, 175, 234, 116, 94, 248, 201, 225,
322+
97, 235, 50, 47, 115, 172, 63, 136, 88, 216, 115, 11, 111, 217, 114, 84, 116, 124, 231,
323+
107, 0, 0, 10, 222, 162, 0, 8, 38, 0, 1, 2, 158, 1, 242, 121, 152, 106, 204, 131, 186,
324+
35, 93, 70, 216, 10, 237, 224, 183, 89, 95, 65, 3, 83, 185, 58, 138, 181, 64, 187, 103,
325+
127, 68, 50, 2, 201, 19, 17, 138, 136, 149, 185, 226, 156, 137, 175, 110, 32, 237, 0,
326+
217, 90, 31, 100, 228, 149, 46, 219, 175, 168, 77, 4, 143, 38, 128, 76, 97, 2, 8, 153,
327+
192, 0, 2, 27, 0, 0, 1, 27, 1, 0, 40, 0, 0, 0, 0, 0, 0, 3, 232, 0, 0, 0, 1, 0, 0, 0,
328+
125, 0, 0, 0, 0, 58, 85, 116, 216, 10, 222, 162, 0, 8, 38, 0, 1, 1, 27, 1, 0, 40, 0, 0,
329+
0, 0, 0, 0, 3, 232, 0, 0, 3, 232, 0, 0, 0, 1, 0, 0, 0, 0, 29, 129, 25, 192,
330+
];
232331

233332
fs::create_dir_all("./tmp/graph-sync-tests");
234333
fs::write("./tmp/graph-sync-tests/test_data.lngossip", valid_response);
@@ -239,16 +338,27 @@ mod tests {
239338
let before = network_graph.to_string();
240339
assert_eq!(before.len(), 31);
241340

242-
let sync_result = sync_network_graph_with_file_path(&network_graph, "./tmp/graph-sync-tests/test_data.lngossip");
341+
let sync_result = sync_network_graph_with_file_path(
342+
&network_graph,
343+
"./tmp/graph-sync-tests/test_data.lngossip",
344+
);
243345

244346
assert!(sync_result.is_ok());
245347

246348
let after = network_graph.to_string();
247349
assert_eq!(after.len(), 1737);
248-
assert!(after.contains("021607cfce19a4c5e7e6e738663dfafbbbac262e4ff76c2c9b30dbeefc35c00643:"));
249-
assert!(after.contains("02247d9db0dfafea745ef8c9e161eb322f73ac3f8858d8730b6fd97254747ce76b:"));
250-
assert!(after.contains("029e01f279986acc83ba235d46d80aede0b7595f410353b93a8ab540bb677f4432:"));
251-
assert!(after.contains("02c913118a8895b9e29c89af6e20ed00d95a1f64e4952edbafa84d048f26804c61:"));
350+
assert!(
351+
after.contains("021607cfce19a4c5e7e6e738663dfafbbbac262e4ff76c2c9b30dbeefc35c00643:")
352+
);
353+
assert!(
354+
after.contains("02247d9db0dfafea745ef8c9e161eb322f73ac3f8858d8730b6fd97254747ce76b:")
355+
);
356+
assert!(
357+
after.contains("029e01f279986acc83ba235d46d80aede0b7595f410353b93a8ab540bb677f4432:")
358+
);
359+
assert!(
360+
after.contains("02c913118a8895b9e29c89af6e20ed00d95a1f64e4952edbafa84d048f26804c61:")
361+
);
252362
assert!(after.contains("channels: [619737530008010752]"));
253363
assert!(after.contains("channels: [783241506229452801]"));
254364
}

0 commit comments

Comments
 (0)