Skip to content

Commit

Permalink
Disable txpool if SequencerUrl is set (#7513)
Browse files Browse the repository at this point in the history
Co-authored-by: lukasz.rozmej <[email protected]>
  • Loading branch information
benaadams and LukaszRozmej authored Oct 11, 2024
1 parent 54a795c commit 43b9af9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Nethermind/Nethermind.Init/Steps/InitializeBlockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ protected virtual IHealthHintService CreateHealthHintService() =>
protected virtual IBlockProductionPolicy CreateBlockProductionPolicy() =>
new BlockProductionPolicy(_api.Config<IMiningConfig>());

protected virtual TxPool.TxPool CreateTxPool(CodeInfoRepository codeInfoRepository) =>
new(_api.EthereumEcdsa!,
protected virtual ITxPool CreateTxPool(CodeInfoRepository codeInfoRepository) =>
new TxPool.TxPool(_api.EthereumEcdsa!,
_api.BlobTxStorage ?? NullBlobTxStorage.Instance,
new ChainHeadInfoProvider(_api.SpecProvider!, _api.BlockTree!, _api.StateReader!, codeInfoRepository),
_api.Config<ITxPoolConfig>(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Nethermind.Evm.TransactionProcessing;
using Nethermind.Init.Steps;
using Nethermind.Merge.Plugin.InvalidChainTracker;
using Nethermind.TxPool;

namespace Nethermind.Optimism;

Expand Down Expand Up @@ -103,4 +104,7 @@ protected override IHealthHintService CreateHealthHintService() =>
new ManualHealthHintService(_blocksConfig.SecondsPerSlot * 6, HealthHintConstants.InfinityHint);

protected override IBlockProductionPolicy CreateBlockProductionPolicy() => AlwaysStartBlockProductionPolicy.Instance;

protected override ITxPool CreateTxPool(CodeInfoRepository codeInfoRepository) =>
api.Config<IOptimismConfig>().SequencerUrl is not null ? NullTxPool.Instance : base.CreateTxPool(codeInfoRepository);
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ protected override void RegisterEthRpcModule(IRpcModuleProvider rpcModuleProvide

if (_config.SequencerUrl is null && _logger.IsWarn)
{
_logger.Warn($"SequencerUrl is not set. Nethermind will behave as a Sequencer");
_logger.Warn("SequencerUrl is not set. Nethermind will behave as a Sequencer");
}

BasicJsonRpcClient? sequencerJsonRpcClient = _config.SequencerUrl is null
? null
: new(new Uri(_config.SequencerUrl), _api.EthereumJsonSerializer, _api.LogManager);
ModuleFactoryBase<IEthRpcModule> ethModuleFactory = CreateEthModuleFactory();
BasicJsonRpcClient? sequencerJsonRpcClient = _config.SequencerUrl is not null
? new(new Uri(_config.SequencerUrl), _api.EthereumJsonSerializer, _api.LogManager)
: null;

ITxSigner txSigner = new WalletTxSigner(_api.Wallet, _api.SpecProvider.ChainId);
TxSealer sealer = new(txSigner, _api.Timestamper);
Expand Down

0 comments on commit 43b9af9

Please sign in to comment.