|
35 | 35 | //! Note that the first ever rapid sync should use `0` for `last_sync_timestamp`.
|
36 | 36 | //!
|
37 | 37 | //! After the gossip data snapshot has been downloaded, one of the client's graph processing
|
38 |
| -//! functions needs to be called. In this example, we process the update by reading its contents |
39 |
| -//! from disk, which we do by calling [`RapidGossipSync::update_network_graph`]: |
| 38 | +//! functions needs to be called. |
| 39 | +#![cfg_attr( |
| 40 | + feature = "std", |
| 41 | + doc = "In this example, we process the update by reading its contents from disk, which we do by calling [`RapidGossipSync::update_network_graph`]:" |
| 42 | +)] |
| 43 | +#![cfg_attr( |
| 44 | + not(feature = "std"), |
| 45 | + doc = "In this example, we process the update by reading its contents from disk, which we do by calling [`RapidGossipSync::update_network_graph_no_std`]:" |
| 46 | +)] |
40 | 47 | //!
|
41 | 48 | //! ```
|
42 | 49 | //! use bitcoin::constants::genesis_block;
|
|
55 | 62 | //! let rapid_sync = RapidGossipSync::new(&network_graph, &logger);
|
56 | 63 | //! let snapshot_contents: &[u8] = &[0; 0];
|
57 | 64 | //! // In non-`std` environments you need to provide the current time in unix epoch seconds
|
58 |
| -//! // otherwise you can use `update_network_graph` |
59 |
| -//! let current_time_unix = 0; |
60 |
| -//! let new_last_sync_timestamp_result = rapid_sync.update_network_graph_no_std(snapshot_contents, Some(current_time_unix)); |
| 65 | +//! // otherwise you can use `update_network_graph`: |
| 66 | +#![cfg_attr( |
| 67 | + feature = "std", |
| 68 | + doc = "let new_last_sync_timestamp_result = rapid_sync.update_network_graph(snapshot_contents);" |
| 69 | +)] |
| 70 | +#![cfg_attr(not(feature = "std"), doc = "let current_time_unix = 0;")] |
| 71 | +#![cfg_attr( |
| 72 | + not(feature = "std"), |
| 73 | + doc = "let new_last_sync_timestamp_result = rapid_sync.update_network_graph_no_std(snapshot_contents, Some(current_time_unix));" |
| 74 | +)] |
61 | 75 | //! ```
|
62 | 76 |
|
63 | 77 | #![cfg_attr(all(not(feature = "std"), not(test)), no_std)]
|
|
0 commit comments