Skip to content

Commit

Permalink
fix(op): Clone impl for OpEthApi (paradigmxyz#10611)
Browse files Browse the repository at this point in the history
  • Loading branch information
emhane authored Aug 29, 2024
1 parent 83b116a commit be57b64
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions crates/optimism/rpc/src/eth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ pub type EthApiNodeBackend<N> = EthApiInner<
///
/// This type implements the [`FullEthApi`](reth_rpc_eth_api::helpers::FullEthApi) by implemented
/// all the `Eth` helper traits and prerequisite traits.
#[derive(Clone)]
pub struct OpEthApi<N: FullNodeComponents> {
inner: Arc<EthApiNodeBackend<N>>,
sequencer_client: parking_lot::RwLock<Option<SequencerClient>>,
sequencer_client: Arc<parking_lot::RwLock<Option<SequencerClient>>>,
}

impl<N: FullNodeComponents> OpEthApi<N> {
Expand All @@ -84,20 +85,7 @@ impl<N: FullNodeComponents> OpEthApi<N> {
ctx.config.proof_permits,
);

Self { inner: Arc::new(inner), sequencer_client: parking_lot::RwLock::new(None) }
}
}

impl<N> Clone for OpEthApi<N>
where
N: FullNodeComponents,
Self: Send + Sync,
{
fn clone(&self) -> Self {
Self {
inner: self.inner.clone(),
sequencer_client: parking_lot::RwLock::new(self.sequencer_client.read().clone()),
}
Self { inner: Arc::new(inner), sequencer_client: Arc::new(parking_lot::RwLock::new(None)) }
}
}

Expand Down

0 comments on commit be57b64

Please sign in to comment.