コード例 #1
0
        public MempoolOrphans(
            ChainIndexer chainIndexer,
            Signals.ISignals signals,
            IMempoolValidator validator,
            ICoinView coinView,
            IDateTimeProvider dateTimeProvider,
            MempoolSettings mempoolSettings,
            ILoggerFactory loggerFactory,
            MempoolManager mempoolManager)
        {
            this.chainIndexer     = chainIndexer;
            this.signals          = signals;
            this.coinView         = coinView;
            this.dateTimeProvider = dateTimeProvider;
            this.mempoolSettings  = mempoolSettings;
            this.mempoolManager   = mempoolManager;
            this.Validator        = validator;

            this.mapOrphanTransactions       = new Dictionary <uint256, OrphanTx>();
            this.mapOrphanTransactionsByPrev = new Dictionary <OutPoint, List <OrphanTx> >(); // OutPoint already correctly implements equality compare
            this.recentRejects             = new Dictionary <uint256, uint256>();
            this.hashRecentRejectsChainTip = uint256.Zero;
            this.logger     = loggerFactory.CreateLogger(this.GetType().FullName);
            this.lockObject = new object();
        }
コード例 #2
0
        public MempoolBehavior(
            IMempoolValidator validator,
            MempoolManager mempoolManager,
            MempoolOrphans orphans,
            IConnectionManager connectionManager,
            IInitialBlockDownloadState initialBlockDownloadState,
            Signals.ISignals signals,
            ILoggerFactory loggerFactory,
            Network network)
        {
            this.validator                 = validator;
            this.mempoolManager            = mempoolManager;
            this.orphans                   = orphans;
            this.connectionManager         = connectionManager;
            this.initialBlockDownloadState = initialBlockDownloadState;
            this.signals                   = signals;
            this.logger        = loggerFactory.CreateLogger(this.GetType().FullName);
            this.loggerFactory = loggerFactory;
            this.network       = network;

            this.lockObject                = new object();
            this.inventoryTxToSend         = new HashSet <uint256>();
            this.filterInventoryKnown      = new HashSet <uint256>();
            this.isPeerWhitelistedForRelay = false;
            this.isBlocksOnlyMode          = false;
        }
コード例 #3
0
        public PosConsensusFeature(
            Network network,
            IChainState chainState,
            IConnectionManager connectionManager,
            IConsensusManager consensusManager,
            NodeDeployments nodeDeployments,
            ConcurrentChain chain,
            IInitialBlockDownloadState initialBlockDownloadState,
            IPeerBanning peerBanning,
            Signals.ISignals signals,
            ILoggerFactory loggerFactory,
            ICheckpoints checkpoints,
            IProvenBlockHeaderStore provenBlockHeaderStore,
            ConnectionManagerSettings connectionManagerSettings) : base(network, chainState, connectionManager, signals, consensusManager, nodeDeployments)
        {
            this.network                   = network;
            this.chainState                = chainState;
            this.connectionManager         = connectionManager;
            this.consensusManager          = consensusManager;
            this.nodeDeployments           = nodeDeployments;
            this.chain                     = chain;
            this.initialBlockDownloadState = initialBlockDownloadState;
            this.peerBanning               = peerBanning;
            this.loggerFactory             = loggerFactory;
            this.checkpoints               = checkpoints;
            this.provenBlockHeaderStore    = provenBlockHeaderStore;
            this.connectionManagerSettings = connectionManagerSettings;

            this.chainState.MaxReorgLength = network.Consensus.MaxReorgLength;
        }
コード例 #4
0
 public MempoolValidator(
     ITxMempool memPool,
     MempoolSchedulerLock mempoolLock,
     IDateTimeProvider dateTimeProvider,
     MempoolSettings mempoolSettings,
     ChainIndexer chainIndexer,
     ICoinView coinView,
     ILoggerFactory loggerFactory,
     NodeSettings nodeSettings,
     IConsensusRuleEngine consensusRules,
     IEnumerable <IMempoolRule> mempoolRules,
     Signals.ISignals signals,
     NodeDeployments nodeDeployments)
 {
     this.memPool          = memPool;
     this.mempoolLock      = mempoolLock;
     this.dateTimeProvider = dateTimeProvider;
     this.mempoolSettings  = mempoolSettings;
     this.chainIndexer     = chainIndexer;
     this.network          = chainIndexer.Network;
     this.coinView         = coinView;
     this.logger           = loggerFactory.CreateLogger(this.GetType().FullName);
     // TODO: Implement later with CheckRateLimit()
     // this.freeLimiter = new FreeLimiterSection();
     this.PerformanceCounter = new MempoolPerformanceCounter(this.dateTimeProvider);
     this.minRelayTxFee      = nodeSettings.MinRelayTxFeeRate;
     this.consensusRules     = consensusRules;
     this.mempoolRules       = mempoolRules.ToList();
     this.signals            = signals;
     this.nodeDeployments    = nodeDeployments;
 }
コード例 #5
0
        public ConsensusFeature(
            Network network,
            IChainState chainState,
            IConnectionManager connectionManager,
            Signals.ISignals signals,
            IConsensusManager consensusManager,
            NodeDeployments nodeDeployments)
        {
            this.chainState        = chainState;
            this.connectionManager = connectionManager;
            this.signals           = signals;
            this.consensusManager  = consensusManager;
            this.nodeDeployments   = nodeDeployments;

            this.chainState.MaxReorgLength = network.Consensus.MaxReorgLength;
        }
コード例 #6
0
 public SmartContractMempoolValidator(ITxMempool memPool,
                                      MempoolSchedulerLock mempoolLock,
                                      IDateTimeProvider dateTimeProvider,
                                      MempoolSettings mempoolSettings,
                                      ChainIndexer chainIndexer,
                                      ICoinView coinView,
                                      ILoggerFactory loggerFactory,
                                      NodeSettings nodeSettings,
                                      IConsensusRuleEngine consensusRules,
                                      IEnumerable <IMempoolRule> mempoolRules,
                                      Signals.ISignals signals,
                                      NodeDeployments nodeDeployments)
     : base(memPool, mempoolLock, dateTimeProvider, mempoolSettings, chainIndexer, coinView, loggerFactory, nodeSettings, consensusRules, mempoolRules, signals, nodeDeployments)
 {
     // Dirty hack, but due to AllowedScriptTypeRule we don't need to check for standard scripts on any network, even live.
     // TODO: Remove ASAP. Ensure RequireStandard isn't used on SC mainnets, or the StandardScripts check is modular.
     mempoolSettings.RequireStandard = false;
 }
コード例 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WalletFeature"/> class.
        /// </summary>
        /// <param name="walletSyncManager">The synchronization manager for the wallet, tasked with keeping the wallet synced with the network.</param>
        /// <param name="walletManager">The wallet manager.</param>
        /// <param name="addressBookManager">The address book manager.</param>
        /// <param name="signals">The signals responsible for receiving blocks and transactions from the network.</param>
        /// <param name="connectionManager">The connection manager.</param>
        /// <param name="broadcasterBehavior">The broadcaster behavior.</param>
        public WalletFeature(
            IWalletSyncManager walletSyncManager,
            IWalletManager walletManager,
            IAddressBookManager addressBookManager,
            Signals.ISignals signals,
            IConnectionManager connectionManager,
            BroadcasterBehavior broadcasterBehavior,
            INodeStats nodeStats)
        {
            this.walletSyncManager   = walletSyncManager;
            this.walletManager       = walletManager;
            this.addressBookManager  = addressBookManager;
            this.signals             = signals;
            this.connectionManager   = connectionManager;
            this.broadcasterBehavior = broadcasterBehavior;

            nodeStats.RegisterStats(this.AddComponentStats, StatsType.Component);
            nodeStats.RegisterStats(this.AddInlineStats, StatsType.Inline, 800);
        }
コード例 #8
0
        public PowConsensusFeature(
            Network network,
            IChainState chainState,
            IConnectionManager connectionManager,
            IConsensusManager consensusManager,
            NodeDeployments nodeDeployments,
            ChainIndexer chainIndexer,
            IInitialBlockDownloadState initialBlockDownloadState,
            IPeerBanning peerBanning,
            Signals.ISignals signals,
            ILoggerFactory loggerFactory) : base(network, chainState, connectionManager, signals, consensusManager, nodeDeployments)
        {
            this.chainState                = chainState;
            this.connectionManager         = connectionManager;
            this.consensusManager          = consensusManager;
            this.nodeDeployments           = nodeDeployments;
            this.chainIndexer              = chainIndexer;
            this.initialBlockDownloadState = initialBlockDownloadState;
            this.peerBanning               = peerBanning;
            this.loggerFactory             = loggerFactory;

            this.chainState.MaxReorgLength = network.Consensus.MaxReorgLength;
        }