reth_payload_builder

Trait PayloadJobGenerator

Source
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: NodePrimitives>(
        &mut self,
        new_state: CanonStateNotification<N>,
    ) { ... }
}
Expand description

A type that knows how to create new jobs for creating payloads.

Required Associated Types§

Source

type Job: PayloadJob

The type that manages the lifecycle of a payload.

This type is a future that yields better payloads.

Required Methods§

Source

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§

Source

fn on_new_state<N: NodePrimitives>( &mut self, new_state: CanonStateNotification<N>, )

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.

Implementors§

Source§

impl PayloadJobGenerator for TestPayloadJobGenerator

Available on crate feature test-utils only.