projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Increase poll::Validate visibility to pub
[rust-lightning]
/
lightning-block-sync
/
src
/
poll.rs
diff --git
a/lightning-block-sync/src/poll.rs
b/lightning-block-sync/src/poll.rs
index fbe803b4cf3f12aafd17b5fb7776346f9686570b..6a1cd6598b5f7971b23c584857b25b1796306d48 100644
(file)
--- a/
lightning-block-sync/src/poll.rs
+++ b/
lightning-block-sync/src/poll.rs
@@
-44,7
+44,9
@@
pub enum ChainTip {
}
/// The `Validate` trait defines behavior for validating chain data.
}
/// The `Validate` trait defines behavior for validating chain data.
-pub(crate) trait Validate {
+///
+/// This trait is sealed and not meant to be implemented outside of this crate.
+pub trait Validate: sealed::Validate {
/// The validated data wrapper which can be dereferenced to obtain the validated data.
type T: std::ops::Deref<Target = Self>;
/// The validated data wrapper which can be dereferenced to obtain the validated data.
type T: std::ops::Deref<Target = Self>;
@@
-156,10
+158,18
@@
impl std::ops::Deref for ValidatedBlock {
}
}
}
}
+mod sealed {
+ /// Used to prevent implementing [`super::Validate`] outside the crate but still allow its use.
+ pub trait Validate {}
+
+ impl Validate for crate::BlockHeaderData {}
+ impl Validate for bitcoin::blockdata::block::Block {}
+}
+
/// The canonical `Poll` implementation used for a single `BlockSource`.
///
/// The canonical `Poll` implementation used for a single `BlockSource`.
///
-/// Other `Poll` implementations
must be built using `ChainPoller` as it provides the only means of
-///
validating chain data
.
+/// Other `Poll` implementations
should be built using `ChainPoller` as it provides the simplest way
+///
of validating chain data and checking consistency
.
pub struct ChainPoller<B: DerefMut<Target=T> + Sized , T: BlockSource> {
block_source: B,
network: Network,
pub struct ChainPoller<B: DerefMut<Target=T> + Sized , T: BlockSource> {
block_source: B,
network: Network,