Skip to content

Commit 81616c2

Browse files
committed
use struct to signify mutations, include chain hash in rapid gossip data, use retrogressed timestamp for update application
1 parent 01f8344 commit 81616c2

File tree

10 files changed

+286
-308
lines changed

10 files changed

+286
-308
lines changed

lightning-block-sync/src/http.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl<'a> std::net::ToSocketAddrs for &'a HttpEndpoint {
9797
}
9898

9999
/// Client for making HTTP requests.
100-
pub struct HttpClient {
100+
pub(crate) struct HttpClient {
101101
address: SocketAddr,
102102
stream: TcpStream,
103103
}

lightning-graph-sync/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Utility to fetch gossip routing data from LNSync or LNSync-like server
1212
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1313

1414
[dependencies]
15-
lightning = { version = "0.0.104", path = "../lightning", features = ["rapid-graph-sync"] }
15+
lightning = { version = "0.0.104", path = "../lightning" }
1616

1717
[dev-dependencies]
1818
bitcoin = { version = "0.27", default-features = false, features = ["secp-recovery"] }

lightning-graph-sync/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ Specifically, our custom channel flags break down like this:
4949
If the most significant bit is set to `0`, indicating a non-incremental update,
5050
`update_data` is formatted as follows:
5151

52-
1. `message_flags`: `u8`
53-
2. `cltv_expiry_delta`: `u16`
54-
3. `htlc_minimum_msat`: `u64`
55-
4. `fee_base_msat`: `u32`
56-
5. `fee_proportional_millionths`: `u32`
57-
6. `htlc_maximum_msat`: `u64` (only if `message_flags'` least significant bit is set to `1`)
52+
1. `cltv_expiry_delta`: `u16`
53+
2. `htlc_minimum_msat`: `u64`
54+
3. `fee_base_msat`: `u32`
55+
4. `fee_proportional_millionths`: `u32`
56+
5. `has_htlc_maximum_msat`: `u8`
57+
6. `htlc_maximum_msat`: `u64` (only if `has_htlc_maximum_msat`'s least significant bit is set to `1`)
5858

5959
If, however, the update is incremental, the intermediate bits of the channel flags
6060
assume new meaning:

lightning-graph-sync/src/lib.rs

+14-12
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,24 @@ mod tests {
3434

3535
use lightning::routing::network_graph::NetworkGraph;
3636

37-
use crate::{sync_network_graph_with_file_path};
37+
use crate::sync_network_graph_with_file_path;
3838

3939
#[test]
4040
fn test_sync_from_file() {
4141
let valid_response = vec![
42-
76, 68, 75, 2, 2, 0, 0, 8, 153, 192, 0, 2, 27, 0, 0, 2, 22, 7, 207, 206, 25, 164, 197,
43-
231, 230, 231, 56, 102, 61, 250, 251, 187, 172, 38, 46, 79, 247, 108, 44, 155, 48, 219,
44-
238, 252, 53, 192, 6, 67, 2, 36, 125, 157, 176, 223, 175, 234, 116, 94, 248, 201, 225,
45-
97, 235, 50, 47, 115, 172, 63, 136, 88, 216, 115, 11, 111, 217, 114, 84, 116, 124, 231,
46-
107, 0, 0, 10, 222, 162, 0, 8, 38, 0, 1, 2, 158, 1, 242, 121, 152, 106, 204, 131, 186,
47-
35, 93, 70, 216, 10, 237, 224, 183, 89, 95, 65, 3, 83, 185, 58, 138, 181, 64, 187, 103,
48-
127, 68, 50, 2, 201, 19, 17, 138, 136, 149, 185, 226, 156, 137, 175, 110, 32, 237, 0,
49-
217, 90, 31, 100, 228, 149, 46, 219, 175, 168, 77, 4, 143, 38, 128, 76, 97, 2, 8, 153,
50-
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,
51-
125, 0, 0, 0, 0, 58, 85, 116, 216, 10, 222, 162, 0, 8, 38, 0, 1, 1, 27, 1, 0, 40, 0, 0,
52-
0, 0, 0, 0, 3, 232, 0, 0, 3, 232, 0, 0, 0, 1, 0, 0, 0, 0, 29, 129, 25, 192,
42+
76, 68, 75, 2, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247,
43+
79, 147, 30, 131, 101, 225, 90, 8, 156, 104, 214, 25, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
44+
8, 153, 192, 0, 2, 27, 0, 0, 2, 22, 7, 207, 206, 25, 164, 197, 231, 230, 231, 56, 102,
45+
61, 250, 251, 187, 172, 38, 46, 79, 247, 108, 44, 155, 48, 219, 238, 252, 53, 192, 6,
46+
67, 2, 36, 125, 157, 176, 223, 175, 234, 116, 94, 248, 201, 225, 97, 235, 50, 47, 115,
47+
172, 63, 136, 88, 216, 115, 11, 111, 217, 114, 84, 116, 124, 231, 107, 0, 0, 10, 222,
48+
162, 0, 8, 38, 0, 1, 2, 158, 1, 242, 121, 152, 106, 204, 131, 186, 35, 93, 70, 216, 10,
49+
237, 224, 183, 89, 95, 65, 3, 83, 185, 58, 138, 181, 64, 187, 103, 127, 68, 50, 2, 201,
50+
19, 17, 138, 136, 149, 185, 226, 156, 137, 175, 110, 32, 237, 0, 217, 90, 31, 100, 228,
51+
149, 46, 219, 175, 168, 77, 4, 143, 38, 128, 76, 97, 0, 0, 0, 2, 8, 153, 192, 0, 2, 27,
52+
0, 0, 1, 0, 40, 0, 0, 0, 0, 0, 0, 3, 232, 0, 0, 0, 1, 0, 0, 0, 125, 1, 0, 0, 0, 0, 58,
53+
85, 116, 216, 10, 222, 162, 0, 8, 38, 0, 1, 1, 0, 40, 0, 0, 0, 0, 0, 0, 3, 232, 0, 0,
54+
3, 232, 0, 0, 0, 1, 1, 0, 0, 0, 0, 29, 129, 25, 192,
5355
];
5456

5557
fs::create_dir_all("./tmp/graph-sync-tests");

0 commit comments

Comments
 (0)