mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
feat(rpc): impl filter changes (#1373)
Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::{BlockNumber, H256};
|
||||
use crate::{rpc::BlockNumber as RpcBlockNumber, BlockNumber, H256};
|
||||
|
||||
/// Current status of the blockchain's head.
|
||||
#[derive(Default, Debug, Eq, PartialEq)]
|
||||
@@ -12,3 +12,17 @@ pub struct ChainInfo {
|
||||
/// Safe block
|
||||
pub safe_finalized: Option<BlockNumber>,
|
||||
}
|
||||
|
||||
impl ChainInfo {
|
||||
/// Attempts to convert a [BlockNumber](crate::rpc::BlockNumber) enum to a numeric value
|
||||
pub fn convert_block_number(&self, number: RpcBlockNumber) -> Option<u64> {
|
||||
match number {
|
||||
RpcBlockNumber::Finalized => self.last_finalized,
|
||||
RpcBlockNumber::Safe => self.safe_finalized,
|
||||
RpcBlockNumber::Earliest => Some(0),
|
||||
RpcBlockNumber::Number(num) => Some(num.as_u64()),
|
||||
RpcBlockNumber::Pending => None,
|
||||
RpcBlockNumber::Latest => Some(self.best_number),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user