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) = TxFilterBuilders.CreateTxPrioritySources(_auraConfig, _api, txPoolReadOnlyTransactionProcessorSource !); ReportTxPriorityRules(txPriorityContract, localDataSource); var minGasPricesContractDataStore = TxFilterBuilders.CreateMinGasPricesDataStore(_api, txPriorityContract, localDataSource); ITxFilter txPoolFilter = TxFilterBuilders.CreateAuRaTxFilter( NethermindApi.Config <IMiningConfig>(), _api, txPoolReadOnlyTransactionProcessorSource, minGasPricesContractDataStore); return(new FilteredTxPool( txStorage, _api.EthereumEcdsa, new ChainHeadSpecProvider(_api.SpecProvider, _api.BlockTree), NethermindApi.Config <ITxPoolConfig>(), _api.ChainHeadStateProvider, _api.TxValidator, _api.LogManager, CreateTxPoolTxComparer(txPriorityContract, localDataSource), new TxFilterAdapter(_api.BlockTree, txPoolFilter))); }
protected override 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) = TxFilterBuilders.CreateTxPrioritySources(_auraConfig, _api, readOnlyTxProcessorSourceForTxPriority); if (_txPriorityContract != null || _localDataSource != null) { _minGasPricesContractDataStore = TxFilterBuilders.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); return(new TxPriorityTxSource( _api.TxPool, processingEnv.StateReader, _api.LogManager, CreateTxSourceFilter(processingEnv, readOnlyTxProcessorSource), whitelistContractDataStore, prioritiesContractDataStore)); } else { return(base.CreateTxPoolTxSource(processingEnv, readOnlyTxProcessorSource)); } }