pub struct ForkFilter { /* private fields */ }
Expand description
Filter that describes the state of blockchain and can be used to check incoming ForkId
s for
compatibility.
Implementations§
Source§impl ForkFilter
impl ForkFilter
Sourcepub fn new<F>(
head: Head,
genesis_hash: B256,
genesis_timestamp: u64,
forks: F,
) -> Selfwhere
F: IntoIterator<Item = ForkFilterKey>,
pub fn new<F>(
head: Head,
genesis_hash: B256,
genesis_timestamp: u64,
forks: F,
) -> Selfwhere
F: IntoIterator<Item = ForkFilterKey>,
Create the filter from provided head, genesis block hash, past forks and expected future forks.
Sourcepub fn set_head(&mut self, head: Head) -> Option<ForkTransition>
pub fn set_head(&mut self, head: Head) -> Option<ForkTransition>
Set the current head.
If the update updates the current ForkId
it returns a ForkTransition
Sourcepub fn set_current_fork_id(&mut self, fork_id: ForkId)
pub fn set_current_fork_id(&mut self, fork_id: ForkId)
Manually set the current fork id.
Caution: this disregards all configured fork filters and is reset on the next head update. This is useful for testing or to connect to networks over p2p where only the latest forkid is known.
Sourcepub fn validate(&self, fork_id: ForkId) -> Result<(), ValidationError>
pub fn validate(&self, fork_id: ForkId) -> Result<(), ValidationError>
Check whether the provided ForkId
is compatible based on the validation rules in
EIP-2124
.
Implements the rules following: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2124.md#stale-software-examples
§Errors
Returns a ValidationError
if the ForkId
is not compatible.
Trait Implementations§
Source§impl Clone for ForkFilter
impl Clone for ForkFilter
Source§fn clone(&self) -> ForkFilter
fn clone(&self) -> ForkFilter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ForkFilter
impl Debug for ForkFilter
Source§impl<'de> Deserialize<'de> for ForkFilter
impl<'de> Deserialize<'de> for ForkFilter
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ForkFilter
impl PartialEq for ForkFilter
Source§impl Serialize for ForkFilter
impl Serialize for ForkFilter
impl Eq for ForkFilter
impl StructuralPartialEq for ForkFilter
Auto Trait Implementations§
impl Freeze for ForkFilter
impl RefUnwindSafe for ForkFilter
impl Send for ForkFilter
impl Sync for ForkFilter
impl Unpin for ForkFilter
impl UnwindSafe for ForkFilter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 232 bytes