Trait reth_payload_builder::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(&mut self, new_state: CanonStateNotification) { ... }
}
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(&mut self, new_state: CanonStateNotification)

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.

Implementors§

source§

impl PayloadJobGenerator for TestPayloadJobGenerator

Available on crate feature test-utils only.