1717//! data. The gossip data is formatted compactly, omitting signatures and opportunistically
1818//! incremental where previous channel updates are known. This mechanism is enabled when the
1919//! timestamp of the last known channel update is communicated. A reference server implementation
20- //! can be found [here ](https://github.com/lightningdevkit/rapid-gossip-sync-server).
20+ //! can be found [on Github ](https://github.com/lightningdevkit/rapid-gossip-sync-server).
2121//!
2222//! The primary benefit of this syncing mechanism is that it allows a low-powered client to offload
2323//! the validation of gossip signatures to a trusted server. This enables the client to privately
2424//! calculate routes for payments, and to do so much faster than requiring a full peer-to-peer
2525//! gossip sync to complete.
2626//!
27- //! The reason the rapid sync server requires trust is that it could provide bogus data, though, at
28- //! worst, all that would result in is a fake network topology, which wouldn't enable the server to
29- //! steal or siphon off funds. It could, however, reduce the client's privacy by forcing all
30- //! payments to be routed via channels the server controls.
31- //!
3227//! The server calculates its repsonse on the basis of a client-provided `latest_seen` timestamp,
3328//! i.e., it will return all rapid gossip sync data it has seen after the given timestamp.
3429//!
3530//! # Getting Started
36- //! Firstly, the data needs to be retrieved from the server. An examplary server request could look
37- //! as simple as the following. Note that the first ever rapid sync should use `0` for
38- //! `last_sync_timestamp`:
31+ //! Firstly, the data needs to be retrieved from the server. For example, you could use the server
32+ //! at <https://rapidsync.lightningdevkit.org> with the following request format:
3933//!
4034//! ```shell
4135//! curl -o rapid_sync.lngossip https://rapidsync.lightningdevkit.org/snapshot/<last_sync_timestamp>
4236//! ```
37+ //! Note that the
38+ //! first ever rapid sync should use `0` for `last_sync_timestamp`.
4339//!
44- //! Then , one of the client's graph processing functions need to be called. In this example, we
45- //! process the update by reading its contents from disk, which we do by calling the
46- //! `sync_network_graph_with_file_path` method :
40+ //! After the gossip data snapshot has been downloaded , one of the client's graph processing
41+ //! functions needs to be called. In this example, we process the update by reading its contents
42+ //! from disk, which we do by calling [sync_network_graph_with_file_path] :
4743//!
4844//! ```
4945//! use bitcoin::blockdata::constants::genesis_block;
6359//! let rapid_sync = RapidGossipSync::new(&network_graph);
6460//! let new_last_sync_timestamp_result = rapid_sync.sync_network_graph_with_file_path("./rapid_sync.lngossip");
6561//! ```
62+ //! [sync_network_graph_with_file_path]: RapidGossipSync::sync_network_graph_with_file_path
6663
6764// Allow and import test features for benching
6865#![ cfg_attr( all( test, feature = "_bench_unstable" ) , feature( test) ) ]
@@ -84,9 +81,7 @@ mod error;
8481/// Core functionality of this crate
8582mod processing;
8683
87- /// The main Rapid Gossip Sync object. See the [crate-level documentation] for a usage example.
88- ///
89- /// [crate-level documentation]: crate
84+ /// The main Rapid Gossip Sync object.
9085pub struct RapidGossipSync < NG : Deref < Target =NetworkGraph < L > > , L : Deref >
9186where L :: Target : Logger {
9287 network_graph : NG ,
0 commit comments