/// <summary>
 /// Initializes an instance of the object.
 /// </summary>
 public PosConsensusRuleEngine(Network network, ILoggerFactory loggerFactory, IDateTimeProvider dateTimeProvider, ChainIndexer chainIndexer, NodeDeployments nodeDeployments,
                               ConsensusSettings consensusSettings, ICheckpoints checkpoints, ICoinView utxoSet, IStakeChain stakeChain, IStakeValidator stakeValidator, IChainState chainState,
                               IInvalidBlockHashStore invalidBlockHashStore, INodeStats nodeStats, IRewindDataIndexCache rewindDataIndexCache, IAsyncProvider asyncProvider, ConsensusRulesContainer consensusRulesContainer)
     : base(network, loggerFactory, dateTimeProvider, chainIndexer, nodeDeployments, consensusSettings, checkpoints, utxoSet, chainState, invalidBlockHashStore, nodeStats, asyncProvider, consensusRulesContainer)
 {
     this.StakeChain           = stakeChain;
     this.StakeValidator       = stakeValidator;
     this.RewindDataIndexCache = rewindDataIndexCache;
 }
Exemplo n.º 2
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="rewindDataIndexCache">Rewind data index store.</param>
        private CachedCoinView(IDateTimeProvider dateTimeProvider, ILoggerFactory loggerFactory, INodeStats nodeStats, StakeChainStore stakeChainStore = null, IRewindDataIndexCache rewindDataIndexCache = null)
        {
            this.logger                = loggerFactory.CreateLogger("Impleum.Bitcoin.FullNode");
            this.dateTimeProvider      = dateTimeProvider;
            this.stakeChainStore       = stakeChainStore;
            this.rewindDataIndexCache  = rewindDataIndexCache;
            this.MaxItems              = CacheMaxItemsDefault;
            this.lockobj               = new object();
            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);
        }
        private CachedCoinView(Network network, ICheckpoints checkpoints, IDateTimeProvider dateTimeProvider, ILoggerFactory loggerFactory, INodeStats nodeStats, ConsensusSettings consensusSettings, StakeChainStore stakeChainStore = null, IRewindDataIndexCache rewindDataIndexCache = null)
        {
            this.logger               = loggerFactory.CreateLogger(this.GetType().FullName);
            this.network              = network;
            this.checkpoints          = checkpoints;
            this.dateTimeProvider     = dateTimeProvider;
            this.consensusSettings    = consensusSettings;
            this.stakeChainStore      = stakeChainStore;
            this.rewindDataIndexCache = rewindDataIndexCache;
            this.lockobj              = new object();
            this.cachedUtxoItems      = new Dictionary <OutPoint, CacheItem>();
            this.performanceCounter   = new CachePerformanceCounter(this.dateTimeProvider);
            this.lastCacheFlushTime   = this.dateTimeProvider.GetUtcNow();
            this.cachedRewindData     = new Dictionary <int, RewindData>();
            this.random               = new Random();

            this.lastCheckpointHeight = this.checkpoints.GetLastCheckpointHeight();

            this.MaxCacheSizeBytes             = consensusSettings.MaxCoindbCacheInMB * 1024 * 1024;
            this.CacheFlushTimeIntervalSeconds = consensusSettings.CoindbIbdFlushMin * 60;

            nodeStats.RegisterStats(this.AddBenchStats, StatsType.Benchmark, this.GetType().Name, 300);
        }
 public CachedCoinView(Network network, ICheckpoints checkpoint, InMemoryCoinView inner, IDateTimeProvider dateTimeProvider, ILoggerFactory loggerFactory, INodeStats nodeStats, ConsensusSettings consensusSettings, StakeChainStore stakeChainStore = null, IRewindDataIndexCache rewindDataIndexCache = null) :
     this(network, checkpoint, dateTimeProvider, loggerFactory, nodeStats, consensusSettings, stakeChainStore, rewindDataIndexCache)
 {
     Guard.NotNull(inner, nameof(inner));
     this.inner = inner;
 }
Exemplo n.º 5
0
 public TestPosConsensusRules(Network network, ILoggerFactory loggerFactory, IDateTimeProvider dateTimeProvider, ChainIndexer chainIndexer,
                              NodeDeployments nodeDeployments, ConsensusSettings consensusSettings, ICheckpoints checkpoints, ICoinView uxtoSet, IStakeChain stakeChain,
                              IStakeValidator stakeValidator, IChainState chainState, IInvalidBlockHashStore invalidBlockHashStore, INodeStats nodeStats, IRewindDataIndexCache rewindDataIndexCache, IAsyncProvider asyncProvider, ConsensusRulesContainer consensusRulesContainer)
     : base(network, loggerFactory, dateTimeProvider, chainIndexer, nodeDeployments, consensusSettings, checkpoints, uxtoSet, stakeChain, stakeValidator, chainState, invalidBlockHashStore, nodeStats, rewindDataIndexCache, asyncProvider, consensusRulesContainer)
 {
     this.ruleRegistrationHelper = new RuleRegistrationHelper(this, consensusRulesContainer);
 }
Exemplo n.º 6
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="rewindDataIndexCache">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, IRewindDataIndexCache rewindDataIndexCache = null) :
     this(dateTimeProvider, loggerFactory, nodeStats, stakeChainStore, rewindDataIndexCache)
 {
     Guard.NotNull(inner, nameof(inner));
     this.inner = inner;
 }