fix(op): Clone impl for OpEthApi (#10611)

This commit is contained in:
Emilia Hane
2024-08-29 20:25:08 +02:00
committed by GitHub
parent 83b116aea7
commit be57b648a7

View File

@ -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> {
@ -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)) }
}
}