Trait Hardforks
pub trait Hardforks: Clone {
// Required methods
fn fork<H>(&self, fork: H) -> ForkCondition
where H: Hardfork;
fn forks_iter(
&self,
) -> impl Iterator<Item = (&(dyn Hardfork + 'static), ForkCondition)>;
fn fork_id(&self, head: &Head) -> ForkId;
fn latest_fork_id(&self) -> ForkId;
fn fork_filter(&self, head: Head) -> ForkFilter;
// Provided methods
fn is_fork_active_at_timestamp<H>(&self, fork: H, timestamp: u64) -> bool
where H: Hardfork { ... }
fn is_fork_active_at_block<H>(&self, fork: H, block_number: u64) -> bool
where H: Hardfork { ... }
}
Expand description
Generic trait over a set of ordered hardforks
Required Methods§
fn fork<H>(&self, fork: H) -> ForkConditionwhere
H: Hardfork,
fn fork<H>(&self, fork: H) -> ForkConditionwhere
H: Hardfork,
Retrieves ForkCondition
from fork
. If fork
is not present, returns
ForkCondition::Never
.
fn forks_iter(
&self,
) -> impl Iterator<Item = (&(dyn Hardfork + 'static), ForkCondition)>
fn forks_iter( &self, ) -> impl Iterator<Item = (&(dyn Hardfork + 'static), ForkCondition)>
Get an iterator of all hardforks with their respective activation conditions.
fn latest_fork_id(&self) -> ForkId
fn latest_fork_id(&self) -> ForkId
Returns the ForkId
for the last fork.
fn fork_filter(&self, head: Head) -> ForkFilter
fn fork_filter(&self, head: Head) -> ForkFilter
Creates a ForkFilter
for the block described by Head.
Provided Methods§
fn is_fork_active_at_timestamp<H>(&self, fork: H, timestamp: u64) -> boolwhere
H: Hardfork,
fn is_fork_active_at_timestamp<H>(&self, fork: H, timestamp: u64) -> boolwhere
H: Hardfork,
Convenience method to check if a fork is active at a given timestamp.
fn is_fork_active_at_block<H>(&self, fork: H, block_number: u64) -> boolwhere
H: Hardfork,
fn is_fork_active_at_block<H>(&self, fork: H, block_number: u64) -> boolwhere
H: Hardfork,
Convenience method to check if a fork is active at a given block number.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.