File tree 3 files changed +24
-0
lines changed
3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 1
1
use lightning:: ln:: msgs:: { DecodeError , LightningError } ;
2
2
3
+ /// All-encompassing standard error type that processing can return
3
4
pub enum GraphSyncError {
5
+ /// IO error wrapper, typically the result of an issue with the file system
4
6
IOError ( std:: io:: Error ) ,
7
+ /// Error trying to read the update data, typically due to an erroneous data length indication
8
+ /// that is greater than the actual amount of data provided
5
9
DecodeError ( DecodeError ) ,
10
+ /// Error applying the patch to the network graph, usually the result of updates that are too
11
+ /// old or missing prerequisite data to the application of updates out of order
6
12
LightningError ( LightningError ) ,
13
+ /// Some other error whose nature is indicated in its descriptor string
7
14
ProcessingError ( String ) ,
8
15
}
9
16
Original file line number Diff line number Diff line change 8
8
#![ deny( unused_variables) ]
9
9
#![ deny( unused_imports) ]
10
10
11
+ //! This crate exposes functionality to rapidly sync gossip data, aimed primarily at mobile
12
+ //! devices.
13
+
11
14
use std:: fs:: File ;
12
15
13
16
use lightning:: routing:: network_graph;
14
17
15
18
use crate :: error:: GraphSyncError ;
16
19
20
+ /// Error types that these functions can return
17
21
pub mod error;
22
+
23
+ /// Core functionality of this crate
18
24
pub mod processing;
19
25
26
+ /// Sync gossip data from a file
27
+ ///
28
+ /// `network_graph`: The network graph to apply the updates to
29
+ ///
30
+ /// `sync_path`: Path to the file where the gossip update data is located
31
+ ///
20
32
pub fn sync_network_graph_with_file_path (
21
33
network_graph : & network_graph:: NetworkGraph ,
22
34
sync_path : & str ,
Original file line number Diff line number Diff line change @@ -19,6 +19,11 @@ use crate::error::GraphSyncError;
19
19
/// data receipt, as opposed to originally signed value. TODO: TBD
20
20
const TIMESTAMP_RETROGRESSION_DELTA : u32 = 7 * 24 * 3600 ;
21
21
22
+ /// Update network graph from binary data
23
+ ///
24
+ /// `network_graph`: network graph to be updated
25
+ ///
26
+ /// `update_data`: `&[u8]` binary stream that comprises the update data
22
27
pub fn update_network_graph (
23
28
network_graph : & network_graph:: NetworkGraph ,
24
29
update_data : & [ u8 ] ,
You can’t perform that action at this time.
0 commit comments