feat: make BuiltPayload generic (#13337)

This commit is contained in:
Tien Nguyen
2024-12-12 19:35:04 +07:00
committed by GitHub
parent 3f55071f62
commit dcdf13731e

View File

@ -5,19 +5,19 @@ use alloy_eips::{
use alloy_primitives::{Address, B256, U256};
use alloy_rpc_types_engine::{PayloadAttributes as EthPayloadAttributes, PayloadId};
use reth_chain_state::ExecutedBlock;
use reth_primitives::SealedBlock;
use reth_primitives::{EthPrimitives, NodePrimitives, SealedBlock};
/// Represents a built payload type that contains a built [`SealedBlock`] and can be converted into
/// engine API execution payloads.
pub trait BuiltPayload: Send + Sync + std::fmt::Debug {
pub trait BuiltPayload<N: NodePrimitives = EthPrimitives>: Send + Sync + std::fmt::Debug {
/// Returns the built block (sealed)
fn block(&self) -> &SealedBlock;
fn block(&self) -> &SealedBlock<N::BlockHeader, N::BlockBody>;
/// Returns the fees collected for the built block
fn fees(&self) -> U256;
/// Returns the entire execution data for the built block, if available.
fn executed_block(&self) -> Option<ExecutedBlock> {
fn executed_block(&self) -> Option<ExecutedBlock<N>> {
None
}