mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
feat: make MissingPayloadBehaviour configurable in EthereumPayloadBuilder (#15161)
This commit is contained in:
@@ -6,6 +6,8 @@ use reth_primitives_traits::constants::GAS_LIMIT_BOUND_DIVISOR;
|
||||
pub struct EthereumBuilderConfig {
|
||||
/// Desired gas limit.
|
||||
pub desired_gas_limit: u64,
|
||||
/// Waits for a payload when there is no payload yet.
|
||||
pub await_payload_on_missing: bool,
|
||||
}
|
||||
|
||||
impl Default for EthereumBuilderConfig {
|
||||
@@ -17,7 +19,7 @@ impl Default for EthereumBuilderConfig {
|
||||
impl EthereumBuilderConfig {
|
||||
/// Create new payload builder config.
|
||||
pub const fn new() -> Self {
|
||||
Self { desired_gas_limit: ETHEREUM_BLOCK_GAS_LIMIT_30M }
|
||||
Self { desired_gas_limit: ETHEREUM_BLOCK_GAS_LIMIT_30M, await_payload_on_missing: false }
|
||||
}
|
||||
|
||||
/// Set desired gas limit.
|
||||
|
||||
@@ -15,7 +15,8 @@ pub use validator::EthereumExecutionPayloadValidator;
|
||||
use alloy_consensus::{Transaction, Typed2718};
|
||||
use alloy_primitives::U256;
|
||||
use reth_basic_payload_builder::{
|
||||
is_better_payload, BuildArguments, BuildOutcome, PayloadBuilder, PayloadConfig,
|
||||
is_better_payload, BuildArguments, BuildOutcome, MissingPayloadBehaviour, PayloadBuilder,
|
||||
PayloadConfig,
|
||||
};
|
||||
use reth_chainspec::{ChainSpec, ChainSpecProvider, EthChainSpec, EthereumHardforks};
|
||||
use reth_errors::{BlockExecutionError, BlockValidationError};
|
||||
@@ -97,6 +98,17 @@ where
|
||||
)
|
||||
}
|
||||
|
||||
fn on_missing_payload(
|
||||
&self,
|
||||
_args: BuildArguments<Self::Attributes, Self::BuiltPayload>,
|
||||
) -> MissingPayloadBehaviour<Self::BuiltPayload> {
|
||||
if self.builder_config.await_payload_on_missing {
|
||||
MissingPayloadBehaviour::AwaitInProgress
|
||||
} else {
|
||||
MissingPayloadBehaviour::RaceEmptyPayload
|
||||
}
|
||||
}
|
||||
|
||||
fn build_empty_payload(
|
||||
&self,
|
||||
config: PayloadConfig<Self::Attributes>,
|
||||
|
||||
Reference in New Issue
Block a user