pub trait Hardforks: Clone {
// Required methods
fn fork<H: Hardfork>(&self, fork: H) -> ForkCondition;
fn forks_iter(&self) -> impl Iterator<Item = (&dyn Hardfork, 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: Hardfork>(
&self,
fork: H,
timestamp: u64,
) -> bool { ... }
fn is_fork_active_at_block<H: Hardfork>(
&self,
fork: H,
block_number: u64,
) -> bool { ... }
}
Expand description
Generic trait over a set of ordered hardforks
Required Methods§
Sourcefn fork<H: Hardfork>(&self, fork: H) -> ForkCondition
fn fork<H: Hardfork>(&self, fork: H) -> ForkCondition
Retrieves ForkCondition
from fork
. If fork
is not present, returns
ForkCondition::Never
.
Sourcefn forks_iter(&self) -> impl Iterator<Item = (&dyn Hardfork, ForkCondition)>
fn forks_iter(&self) -> impl Iterator<Item = (&dyn Hardfork, ForkCondition)>
Get an iterator of all hardforks with their respective activation conditions.
Sourcefn latest_fork_id(&self) -> ForkId
fn latest_fork_id(&self) -> ForkId
Returns the ForkId
for the last fork.
Sourcefn fork_filter(&self, head: Head) -> ForkFilter
fn fork_filter(&self, head: Head) -> ForkFilter
Creates a ForkFilter
for the block described by Head.
Provided Methods§
Sourcefn is_fork_active_at_timestamp<H: Hardfork>(
&self,
fork: H,
timestamp: u64,
) -> bool
fn is_fork_active_at_timestamp<H: Hardfork>( &self, fork: H, timestamp: u64, ) -> bool
Convenience method to check if a fork is active at a given timestamp.
Sourcefn is_fork_active_at_block<H: Hardfork>(
&self,
fork: H,
block_number: u64,
) -> bool
fn is_fork_active_at_block<H: Hardfork>( &self, fork: H, block_number: u64, ) -> bool
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.