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<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

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

Implementations on Foreign Types§

§

impl<Client, Pool, Tasks, Builder> PayloadJobGenerator for BasicPayloadJobGenerator<Client, Pool, Tasks, Builder>
where Client: StateProviderFactory + BlockReaderIdExt<Header = Header> + 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<N>(&mut self, new_state: CanonStateNotification<N>)
where N: NodePrimitives,

Implementors§