fix: enable autoseal in op correctly (#8961)

This commit is contained in:
Matthias Seitz
2024-06-19 18:48:53 +02:00
committed by GitHub
parent 254647c425
commit d0b27f0635
3 changed files with 12 additions and 2 deletions

View File

@ -15,7 +15,9 @@ workspace = true
reth-chainspec.workspace = true
reth-primitives.workspace = true
reth-payload-builder.workspace = true
reth-auto-seal-consensus.workspace = true
reth-basic-payload-builder.workspace = true
reth-consensus.workspace = true
reth-optimism-payload-builder.workspace = true
reth-rpc-types.workspace = true
reth-rpc.workspace = true
@ -67,4 +69,5 @@ optimism = [
"reth-optimism-payload-builder/optimism",
"reth-beacon-consensus/optimism",
"reth-revm/optimism",
"reth-auto-seal-consensus/optimism",
]

View File

@ -25,6 +25,7 @@ use reth_transaction_pool::{
blobstore::DiskFileBlobStore, CoinbaseTipOrdering, TransactionPool,
TransactionValidationTaskExecutor,
};
use std::sync::Arc;
/// Type configuration for a regular Optimism node.
#[derive(Debug, Default, Clone)]
@ -317,9 +318,13 @@ impl<Node> ConsensusBuilder<Node> for OptimismConsensusBuilder
where
Node: FullNodeTypes,
{
type Consensus = OptimismBeaconConsensus;
type Consensus = Arc<dyn reth_consensus::Consensus>;
async fn build_consensus(self, ctx: &BuilderContext<Node>) -> eyre::Result<Self::Consensus> {
Ok(OptimismBeaconConsensus::new(ctx.chain_spec()))
if ctx.is_dev() {
Ok(Arc::new(reth_auto_seal_consensus::AutoSealConsensus::new(ctx.chain_spec())))
} else {
Ok(Arc::new(OptimismBeaconConsensus::new(ctx.chain_spec())))
}
}
}