Trait PayloadJobGenerator
pub trait PayloadJobGenerator: Send + Sync {
type Job: PayloadJob;
// Required method
fn new_payload_job(
&self,
attr: <Self::Job as PayloadJob>::PayloadAttributes,
) -> Result<Self::Job, PayloadBuilderError>;
// Provided method
fn on_new_state<N>(&mut self, new_state: CanonStateNotification<N>)
where N: NodePrimitives { ... }
}
Expand description
A type that knows how to create new jobs for creating payloads.
Required Associated Types§
type Job: PayloadJob
type Job: PayloadJob
The type that manages the lifecycle of a payload.
This type is a future that yields better payloads.
Required Methods§
fn new_payload_job(
&self,
attr: <Self::Job as PayloadJob>::PayloadAttributes,
) -> Result<Self::Job, PayloadBuilderError>
fn new_payload_job( &self, attr: <Self::Job as PayloadJob>::PayloadAttributes, ) -> Result<Self::Job, PayloadBuilderError>
Creates the initial payload and a new PayloadJob
that yields better payloads over time.
This is called when the CL requests a new payload job via a fork choice update.
§Note
This is expected to initially build a new (empty) payload without transactions, so it can be returned directly.
Provided Methods§
fn on_new_state<N>(&mut self, new_state: CanonStateNotification<N>)where
N: NodePrimitives,
fn on_new_state<N>(&mut self, new_state: CanonStateNotification<N>)where
N: NodePrimitives,
Handles new chain state events
This is intended for any logic that needs to be run when the chain state changes or used to use the in memory state for the head block.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.