Skip to content

Commit 3618c89

Browse files
committed
Increase poll::Validate visibility to pub
Previously, poll::Validate was pub(crate) to force external implementors of Poll to define their implementation in terms of ChainPoller. This was because ChainPoller::look_up_previous_header checks for consistency between headers and any errors would be checked at that level rather than by the caller. Otherwise, if performed by the caller, a Poll implementation would not be aware if the underlying BlockSource was providing bad data and therefore couldn't react accordingly. Widening the visibility to pub relaxes this requirement, although it's still encourage to use ChainPoller to implement Poll. This permits either copying or moving lightning-block-sync's test utilities to a separate crate since they use poll::Validate.
1 parent 2940099 commit 3618c89

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lightning-block-sync/src/poll.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub enum ChainTip {
4444
}
4545

4646
/// The `Validate` trait defines behavior for validating chain data.
47-
pub(crate) trait Validate {
47+
pub trait Validate {
4848
/// The validated data wrapper which can be dereferenced to obtain the validated data.
4949
type T: std::ops::Deref<Target = Self>;
5050

@@ -158,8 +158,8 @@ impl std::ops::Deref for ValidatedBlock {
158158

159159
/// The canonical `Poll` implementation used for a single `BlockSource`.
160160
///
161-
/// Other `Poll` implementations must be built using `ChainPoller` as it provides the only means of
162-
/// validating chain data.
161+
/// Other `Poll` implementations should be built using `ChainPoller` as it provides the simplest way
162+
/// of validating chain data and checking consistency.
163163
pub struct ChainPoller<B: DerefMut<Target=T> + Sized , T: BlockSource> {
164164
block_source: B,
165165
network: Network,

0 commit comments

Comments
 (0)