Struct ForkFilter
pub struct ForkFilter { /* private fields */ }
Expand description
Re-exported EIP-2124 forkid types.
Filter that describes the state of blockchain and can be used to check incoming ForkId
s for
compatibility.
Implementations§
§impl ForkFilter
impl ForkFilter
pub fn new<F>(
head: Head,
genesis_hash: FixedBytes<32>,
genesis_timestamp: u64,
forks: F,
) -> ForkFilterwhere
F: IntoIterator<Item = ForkFilterKey>,
pub fn new<F>(
head: Head,
genesis_hash: FixedBytes<32>,
genesis_timestamp: u64,
forks: F,
) -> ForkFilterwhere
F: IntoIterator<Item = ForkFilterKey>,
Create the filter from provided head, genesis block hash, past forks and expected future forks.
pub 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
pub 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.
pub 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§
§impl Clone for ForkFilter
impl Clone for ForkFilter
§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 more§impl Debug for ForkFilter
impl Debug for ForkFilter
§impl<'de> Deserialize<'de> for ForkFilter
impl<'de> Deserialize<'de> for ForkFilter
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ForkFilter, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ForkFilter, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl PartialEq for ForkFilter
impl PartialEq for ForkFilter
§impl Serialize for ForkFilter
impl Serialize for ForkFilter
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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