protected override TxPool.TxPool CreateTxPool(PersistentTxStorage txStorage) { // This has to be different object than the _processingReadOnlyTransactionProcessorSource as this is in separate thread var txPoolReadOnlyTransactionProcessorSource = CreateReadOnlyTransactionProcessorSource(); var(txPriorityContract, localDataSource) = TxAuRaFilterBuilders.CreateTxPrioritySources(_auraConfig, _api, txPoolReadOnlyTransactionProcessorSource !); ReportTxPriorityRules(txPriorityContract, localDataSource); var minGasPricesContractDataStore = TxAuRaFilterBuilders.CreateMinGasPricesDataStore(_api, txPriorityContract, localDataSource); ITxFilter txPoolFilter = TxAuRaFilterBuilders.CreateAuRaTxFilterForProducer( NethermindApi.Config <IMiningConfig>(), _api, txPoolReadOnlyTransactionProcessorSource, minGasPricesContractDataStore, _api.SpecProvider); return(new FilteredTxPool( txStorage, _api.EthereumEcdsa, new ChainHeadInfoProvider(_api.SpecProvider, _api.BlockTree, _api.StateReader), NethermindApi.Config <ITxPoolConfig>(), _api.TxValidator, _api.LogManager, CreateTxPoolTxComparer(txPriorityContract, localDataSource), new TxFilterAdapter(_api.BlockTree, txPoolFilter))); }
private TxPoolTxSource CreateTxPoolTxSource(ReadOnlyTxProcessingEnv processingEnv, IReadOnlyTxProcessorSource readOnlyTxProcessorSource) { // We need special one for TxPriority as its following Head separately with events and we want rules from Head, not produced block IReadOnlyTxProcessorSource readOnlyTxProcessorSourceForTxPriority = new ReadOnlyTxProcessingEnv(_api.DbProvider, _api.ReadOnlyTrieStore, _api.BlockTree, _api.SpecProvider, _api.LogManager); (_txPriorityContract, _localDataSource) = TxAuRaFilterBuilders.CreateTxPrioritySources(_auraConfig, _api, readOnlyTxProcessorSourceForTxPriority); if (_txPriorityContract != null || _localDataSource != null) { _minGasPricesContractDataStore = TxAuRaFilterBuilders.CreateMinGasPricesDataStore(_api, _txPriorityContract, _localDataSource) !; _api.DisposeStack.Push(_minGasPricesContractDataStore); ContractDataStore <Address> whitelistContractDataStore = new ContractDataStoreWithLocalData <Address>( new HashSetContractDataStoreCollection <Address>(), _txPriorityContract?.SendersWhitelist, _api.BlockTree, _api.ReceiptFinder, _api.LogManager, _localDataSource?.GetWhitelistLocalDataSource() ?? new EmptyLocalDataSource <IEnumerable <Address> >()); DictionaryContractDataStore <TxPriorityContract.Destination> prioritiesContractDataStore = new DictionaryContractDataStore <TxPriorityContract.Destination>( new TxPriorityContract.DestinationSortedListContractDataStoreCollection(), _txPriorityContract?.Priorities, _api.BlockTree, _api.ReceiptFinder, _api.LogManager, _localDataSource?.GetPrioritiesLocalDataSource()); _api.DisposeStack.Push(whitelistContractDataStore); _api.DisposeStack.Push(prioritiesContractDataStore); ITxFilter auraTxFilter = CreateAuraTxFilterForProducer(readOnlyTxProcessorSource, _api.SpecProvider); ITxFilterPipeline txFilterPipeline = new TxFilterPipelineBuilder(_api.LogManager) .WithCustomTxFilter(auraTxFilter) .WithBaseFeeFilter(_api.SpecProvider) .WithNullTxFilter() .Build; return(new TxPriorityTxSource( _api.TxPool, processingEnv.StateReader, _api.LogManager, txFilterPipeline, whitelistContractDataStore, prioritiesContractDataStore, _api.SpecProvider, _api.TransactionComparerProvider)); } else { return(CreateStandardTxPoolTxSource(processingEnv, readOnlyTxProcessorSource)); } }