reth::payload

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

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

Required Associated Types§

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>

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(&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.

Implementations on Foreign Types§

§

impl<Client, Pool, Tasks, Builder> PayloadJobGenerator for BasicPayloadJobGenerator<Client, Pool, Tasks, Builder>
where Client: StateProviderFactory + BlockReaderIdExt + Clone + Unpin + 'static, Pool: TransactionPool + Unpin + 'static, Tasks: TaskSpawner + Clone + Unpin + 'static, Builder: PayloadBuilder<Pool, Client> + Unpin + 'static, <Builder as PayloadBuilder<Pool, Client>>::Attributes: Unpin + Clone, <Builder as PayloadBuilder<Pool, Client>>::BuiltPayload: Unpin + Clone,

§

type Job = BasicPayloadJob<Client, Pool, Tasks, Builder>

§

fn new_payload_job( &self, attributes: <<BasicPayloadJobGenerator<Client, Pool, Tasks, Builder> as PayloadJobGenerator>::Job as PayloadJob>::PayloadAttributes, ) -> Result<<BasicPayloadJobGenerator<Client, Pool, Tasks, Builder> as PayloadJobGenerator>::Job, PayloadBuilderError>

§

fn on_new_state(&mut self, new_state: CanonStateNotification)

Implementors§