mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add is_ethereum trait fn (#12197)
This commit is contained in:
@ -57,6 +57,11 @@ pub trait EthChainSpec: Send + Sync + Unpin + Debug {
|
||||
fn is_optimism(&self) -> bool {
|
||||
self.chain().is_optimism()
|
||||
}
|
||||
|
||||
/// Returns `true` if this chain contains Ethereum configuration.
|
||||
fn is_ethereum(&self) -> bool {
|
||||
self.chain().is_ethereum()
|
||||
}
|
||||
}
|
||||
|
||||
impl EthChainSpec for ChainSpec {
|
||||
|
||||
@ -20,12 +20,11 @@ impl NetworkStackId {
|
||||
/// ENR fork ID kv-pair key, for an Optimism CL node.
|
||||
pub const OPSTACK: &'static [u8] = b"opstack";
|
||||
|
||||
#[allow(clippy::missing_const_for_fn)]
|
||||
/// Returns the [`NetworkStackId`] that matches the given chain spec.
|
||||
pub fn id(chain: impl EthChainSpec) -> Option<&'static [u8]> {
|
||||
if chain.chain().is_optimism() {
|
||||
if chain.is_optimism() {
|
||||
return Some(Self::OPEL)
|
||||
} else if chain.chain().is_ethereum() {
|
||||
} else if chain.is_ethereum() {
|
||||
return Some(Self::ETH)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user