public SmartContractPosConsensusRuleEngine(
     ICallDataSerializer callDataSerializer,
     ConcurrentChain chain,
     ICheckpoints checkpoints,
     ConsensusSettings consensusSettings,
     IDateTimeProvider dateTimeProvider,
     IContractExecutorFactory executorFactory,
     ILoggerFactory loggerFactory,
     Network network,
     NodeDeployments nodeDeployments,
     IStateRepositoryRoot originalStateRoot,
     IReceiptRepository receiptRepository,
     ISenderRetriever senderRetriever,
     IStakeChain stakeChain,
     IStakeValidator stakeValidator,
     ICoinView utxoSet,
     IChainState chainState,
     IInvalidBlockHashStore invalidBlockHashStore,
     INodeStats nodeStats,
     IRewindDataIndexStore rewindDataIndexStore)
     : base(network, loggerFactory, dateTimeProvider, chain, nodeDeployments, consensusSettings, checkpoints, utxoSet, stakeChain, stakeValidator, chainState, invalidBlockHashStore, nodeStats, rewindDataIndexStore)
 {
     this.CallDataSerializer = callDataSerializer;
     this.ExecutorFactory    = executorFactory;
     this.OriginalStateRoot  = originalStateRoot;
     this.ReceiptRepository  = receiptRepository;
     this.SenderRetriever    = senderRetriever;
 }
 /// <summary>
 /// Initializes an instance of the object.
 /// </summary>
 public PosConsensusRuleEngine(Network network, ILoggerFactory loggerFactory, IDateTimeProvider dateTimeProvider, ConcurrentChain chain, NodeDeployments nodeDeployments,
                               ConsensusSettings consensusSettings, ICheckpoints checkpoints, ICoinView utxoSet, IStakeChain stakeChain, IStakeValidator stakeValidator, IChainState chainState,
                               IInvalidBlockHashStore invalidBlockHashStore, INodeStats nodeStats, IRewindDataIndexStore rewindDataIndexStore)
     : base(network, loggerFactory, dateTimeProvider, chain, nodeDeployments, consensusSettings, checkpoints, utxoSet, chainState, invalidBlockHashStore, nodeStats)
 {
     this.StakeChain           = stakeChain;
     this.StakeValidator       = stakeValidator;
     this.RewindDataIndexStore = rewindDataIndexStore;
 }
Beispiel #3
0
        /// <summary>
        /// Initializes instance of the object based.
        /// </summary>
        /// <param name="dateTimeProvider">Provider of time functions.</param>
        /// <param name="loggerFactory">Factory to be used to create logger for the puller.</param>
        /// <param name="nodeStats">The node stats.</param>
        /// <param name="stakeChainStore">Storage of POS block information.</param>
        /// <param name="rewindDataIndexStore">Rewind data index store.</param>
        private CachedCoinView(IDateTimeProvider dateTimeProvider, ILoggerFactory loggerFactory, INodeStats nodeStats, StakeChainStore stakeChainStore = null, IRewindDataIndexStore rewindDataIndexStore = null)
        {
            this.logger                = loggerFactory.CreateLogger(this.GetType().FullName);
            this.dateTimeProvider      = dateTimeProvider;
            this.stakeChainStore       = stakeChainStore;
            this.rewindDataIndexStore  = rewindDataIndexStore;
            this.MaxItems              = CacheMaxItemsDefault;
            this.lockobj               = new AsyncLock();
            this.cachedUtxoItems       = new Dictionary <uint256, CacheItem>();
            this.performanceCounter    = new CachePerformanceCounter(this.dateTimeProvider);
            this.lastCacheFlushTime    = this.dateTimeProvider.GetUtcNow();
            this.cachedRewindDataIndex = new SortedDictionary <int, RewindData>();
            this.random                = new Random();

            nodeStats.RegisterStats(this.AddBenchStats, StatsType.Benchmark, 300);
        }
Beispiel #4
0
 /// <summary>
 /// Initializes instance of the object based on memory based coinview.
 /// </summary>
 /// <param name="inner">Underlying coinview with memory based storage.</param>
 /// <param name="dateTimeProvider">Provider of time functions.</param>
 /// <param name="loggerFactory">Factory to be used to create logger for the puller.</param>
 /// <param name="nodeStats">The node stats.</param>
 /// <param name="stakeChainStore">Storage of POS block information.</param>
 /// <param name="rewindDataIndexStore">Rewind data index store.</param>
 /// <remarks>
 /// This is used for testing the coinview.
 /// It allows a coin view that only has in-memory entries.
 /// </remarks>
 public CachedCoinView(InMemoryCoinView inner, IDateTimeProvider dateTimeProvider, ILoggerFactory loggerFactory, INodeStats nodeStats, StakeChainStore stakeChainStore = null, IRewindDataIndexStore rewindDataIndexStore = null) :
     this(dateTimeProvider, loggerFactory, nodeStats, stakeChainStore, rewindDataIndexStore)
 {
     Guard.NotNull(inner, nameof(inner));
     this.inner = inner;
 }
Beispiel #5
0
 public TestPosConsensusRules(Network network, ILoggerFactory loggerFactory, IDateTimeProvider dateTimeProvider, ConcurrentChain chain,
                              NodeDeployments nodeDeployments, ConsensusSettings consensusSettings, ICheckpoints checkpoints, ICoinView uxtoSet, IStakeChain stakeChain,
                              IStakeValidator stakeValidator, IChainState chainState, IInvalidBlockHashStore invalidBlockHashStore, INodeStats nodeStats, IRewindDataIndexStore rewindDataIndexStore)
     : base(network, loggerFactory, dateTimeProvider, chain, nodeDeployments, consensusSettings, checkpoints, uxtoSet, stakeChain, stakeValidator, chainState, invalidBlockHashStore, nodeStats, rewindDataIndexStore)
 {
     this.ruleRegistrationHelper = new RuleRegistrationHelper();
 }