mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: change build_empty_payload to require &self (#8646)
This commit is contained in:
@ -103,6 +103,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn build_empty_payload(
|
fn build_empty_payload(
|
||||||
|
&self,
|
||||||
client: &Client,
|
client: &Client,
|
||||||
config: PayloadConfig<Self::Attributes>,
|
config: PayloadConfig<Self::Attributes>,
|
||||||
) -> Result<OptimismBuiltPayload, PayloadBuilderError> {
|
) -> Result<OptimismBuiltPayload, PayloadBuilderError> {
|
||||||
|
|||||||
@ -460,7 +460,7 @@ where
|
|||||||
// away and the first full block should have been built by the time CL is requesting the
|
// away and the first full block should have been built by the time CL is requesting the
|
||||||
// payload.
|
// payload.
|
||||||
self.metrics.inc_requested_empty_payload();
|
self.metrics.inc_requested_empty_payload();
|
||||||
Builder::build_empty_payload(&self.client, self.config.clone())
|
self.builder.build_empty_payload(&self.client, self.config.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn payload_attributes(&self) -> Result<Self::PayloadAttributes, PayloadBuilderError> {
|
fn payload_attributes(&self) -> Result<Self::PayloadAttributes, PayloadBuilderError> {
|
||||||
@ -501,8 +501,9 @@ where
|
|||||||
let (tx, rx) = oneshot::channel();
|
let (tx, rx) = oneshot::channel();
|
||||||
let client = self.client.clone();
|
let client = self.client.clone();
|
||||||
let config = self.config.clone();
|
let config = self.config.clone();
|
||||||
|
let builder = self.builder.clone();
|
||||||
self.executor.spawn_blocking(Box::pin(async move {
|
self.executor.spawn_blocking(Box::pin(async move {
|
||||||
let res = Builder::build_empty_payload(&client, config);
|
let res = builder.build_empty_payload(&client, config);
|
||||||
let _ = tx.send(res);
|
let _ = tx.send(res);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -784,6 +785,7 @@ pub trait PayloadBuilder<Pool, Client>: Send + Sync + Clone {
|
|||||||
|
|
||||||
/// Builds an empty payload without any transaction.
|
/// Builds an empty payload without any transaction.
|
||||||
fn build_empty_payload(
|
fn build_empty_payload(
|
||||||
|
&self,
|
||||||
client: &Client,
|
client: &Client,
|
||||||
config: PayloadConfig<Self::Attributes>,
|
config: PayloadConfig<Self::Attributes>,
|
||||||
) -> Result<Self::BuiltPayload, PayloadBuilderError>;
|
) -> Result<Self::BuiltPayload, PayloadBuilderError>;
|
||||||
|
|||||||
@ -77,6 +77,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn build_empty_payload(
|
fn build_empty_payload(
|
||||||
|
&self,
|
||||||
client: &Client,
|
client: &Client,
|
||||||
config: PayloadConfig<Self::Attributes>,
|
config: PayloadConfig<Self::Attributes>,
|
||||||
) -> Result<EthBuiltPayload, PayloadBuilderError> {
|
) -> Result<EthBuiltPayload, PayloadBuilderError> {
|
||||||
|
|||||||
@ -302,6 +302,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn build_empty_payload(
|
fn build_empty_payload(
|
||||||
|
&self,
|
||||||
client: &Client,
|
client: &Client,
|
||||||
config: PayloadConfig<Self::Attributes>,
|
config: PayloadConfig<Self::Attributes>,
|
||||||
) -> Result<Self::BuiltPayload, PayloadBuilderError> {
|
) -> Result<Self::BuiltPayload, PayloadBuilderError> {
|
||||||
@ -313,9 +314,8 @@ where
|
|||||||
attributes,
|
attributes,
|
||||||
chain_spec,
|
chain_spec,
|
||||||
} = config;
|
} = config;
|
||||||
<reth_ethereum_payload_builder::EthereumPayloadBuilder as PayloadBuilder<Pool,Client>> ::build_empty_payload(client,
|
<reth_ethereum_payload_builder::EthereumPayloadBuilder as PayloadBuilder<Pool, Client>>::build_empty_payload(&reth_ethereum_payload_builder::EthereumPayloadBuilder::default(),client,
|
||||||
PayloadConfig { initialized_block_env, initialized_cfg, parent_block, extra_data, attributes: attributes.0, chain_spec }
|
PayloadConfig { initialized_block_env, initialized_cfg, parent_block, extra_data, attributes: attributes.0, chain_spec })
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -89,7 +89,7 @@ where
|
|||||||
client: self.client.clone(),
|
client: self.client.clone(),
|
||||||
_pool: self.pool.clone(),
|
_pool: self.pool.clone(),
|
||||||
_executor: self.executor.clone(),
|
_executor: self.executor.clone(),
|
||||||
_builder: self.builder.clone(),
|
builder: self.builder.clone(),
|
||||||
config,
|
config,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ where
|
|||||||
/// The type responsible for building payloads.
|
/// The type responsible for building payloads.
|
||||||
///
|
///
|
||||||
/// See [PayloadBuilder]
|
/// See [PayloadBuilder]
|
||||||
pub(crate) _builder: Builder,
|
pub(crate) builder: Builder,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Client, Pool, Tasks, Builder> PayloadJob for EmptyBlockPayloadJob<Client, Pool, Tasks, Builder>
|
impl<Client, Pool, Tasks, Builder> PayloadJob for EmptyBlockPayloadJob<Client, Pool, Tasks, Builder>
|
||||||
@ -44,7 +44,7 @@ where
|
|||||||
type BuiltPayload = Builder::BuiltPayload;
|
type BuiltPayload = Builder::BuiltPayload;
|
||||||
|
|
||||||
fn best_payload(&self) -> Result<Self::BuiltPayload, PayloadBuilderError> {
|
fn best_payload(&self) -> Result<Self::BuiltPayload, PayloadBuilderError> {
|
||||||
let payload = Builder::build_empty_payload(&self.client, self.config.clone())?;
|
let payload = self.builder.build_empty_payload(&self.client, self.config.clone())?;
|
||||||
Ok(payload)
|
Ok(payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user