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 ForkIds for
compatibility.
Implementations§
Source§impl ForkFilter
impl ForkFilter
Sourcepub 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.
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 more