File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,9 @@ pub enum ChainTip {
4444}
4545
4646/// The `Validate` trait defines behavior for validating chain data.
47- pub trait Validate {
47+ ///
48+ /// This trait is sealed and not meant to be implemented outside of this crate.
49+ pub trait Validate : sealed:: Validate {
4850 /// The validated data wrapper which can be dereferenced to obtain the validated data.
4951 type T : std:: ops:: Deref < Target = Self > ;
5052
@@ -156,6 +158,14 @@ impl std::ops::Deref for ValidatedBlock {
156158 }
157159}
158160
161+ mod sealed {
162+ /// Used to prevent implementing [`super::Validate`] outside the crate but still allow its use.
163+ pub trait Validate { }
164+
165+ impl Validate for crate :: BlockHeaderData { }
166+ impl Validate for bitcoin:: blockdata:: block:: Block { }
167+ }
168+
159169/// The canonical `Poll` implementation used for a single `BlockSource`.
160170///
161171/// Other `Poll` implementations should be built using `ChainPoller` as it provides the simplest way
You can’t perform that action at this time.
0 commit comments