@@ -14,21 +14,21 @@ use std::pin::Pin;
14
14
15
15
/// Abstract type for retrieving block headers and data.
16
16
pub trait BlockSource : Sync + Send {
17
- /// Returns the header for a given hash. A height hint may be provided in case a source cannot
18
- /// easily find headers based on a hash. This is merely a hint and thus the returned header must
19
- /// have the same hash as was requested. Otherwise, an error must be returned.
17
+ /// Returns the header for a given hash. A height hint may be provided in case a block source
18
+ /// cannot easily find headers based on a hash. This is merely a hint and thus the returned
19
+ /// header must have the same hash as was requested. Otherwise, an error must be returned.
20
20
///
21
21
/// Implementations that cannot find headers based on the hash should return a `Transient` error
22
- /// when `height_hint` is `None`. In such a case, `get_best_block` should never return `None`
23
- /// for the height. Otherwise, the source could not be used independently for an initial sync.
22
+ /// when `height_hint` is `None`.
24
23
fn get_header < ' a > ( & ' a mut self , header_hash : & ' a BlockHash , height_hint : Option < u32 > ) -> AsyncBlockSourceResult < ' a , BlockHeaderData > ;
25
24
26
25
/// Returns the block for a given hash. A headers-only block source should return a `Transient`
27
26
/// error.
28
27
fn get_block < ' a > ( & ' a mut self , header_hash : & ' a BlockHash ) -> AsyncBlockSourceResult < ' a , Block > ;
29
28
30
- /// Returns the hash of the best block and, optionally, its height. The height is passed to
31
- /// `get_header` to allow a more efficient lookup on some block sources.
29
+ // TODO: Phrase in terms of `Poll` once added.
30
+ /// Returns the hash of the best block and, optionally, its height. When polling a block source,
31
+ /// the height is passed to `get_header` to allow for a more efficient lookup.
32
32
fn get_best_block < ' a > ( & ' a mut self ) -> AsyncBlockSourceResult < ( BlockHash , Option < u32 > ) > ;
33
33
}
34
34
0 commit comments