File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ use std::ops::DerefMut;
88
99/// The `Poll` trait defines behavior for polling block sources for a chain tip and retrieving
1010/// related chain data. It serves as an adapter for `BlockSource`.
11+ ///
12+ /// [`ChainPoller`] adapts a single `BlockSource`, while any other implementations of `Poll` are
13+ /// required to be built in terms of it to ensure chain data validity.
14+ ///
15+ /// [`ChainPoller`]: ../struct.ChainPoller.html
1116pub trait Poll {
1217 /// Returns a chain tip in terms of its relationship to the provided chain tip.
1318 fn poll_chain_tip < ' a > ( & ' a mut self , best_known_chain_tip : ValidatedBlockHeader ) ->
@@ -149,12 +154,20 @@ impl std::ops::Deref for ValidatedBlock {
149154 }
150155}
151156
157+ /// The canonical `Poll` implementation used for a single `BlockSource`.
158+ ///
159+ /// Other `Poll` implementations must be built using `ChainPoller` as it provides the only means of
160+ /// validating chain data.
152161pub struct ChainPoller < B : DerefMut < Target =T > + Sized + Sync + Send , T : BlockSource > {
153162 block_source : B ,
154163 network : Network ,
155164}
156165
157166impl < B : DerefMut < Target =T > + Sized + Sync + Send , T : BlockSource > ChainPoller < B , T > {
167+ /// Creates a new poller for the given block source.
168+ ///
169+ /// If the `network` parameter is mainnet, then the difficulty between blocks is checked for
170+ /// validity.
158171 pub fn new ( block_source : B , network : Network ) -> Self {
159172 Self { block_source, network }
160173 }
You can’t perform that action at this time.
0 commit comments