protected BlockDefinition( IConsensusManager consensusManager, IDateTimeProvider dateTimeProvider, ILoggerFactory loggerFactory, ITxMempool mempool, MempoolSchedulerLock mempoolLock, MinerSettings minerSettings, Network network, NodeDeployments nodeDeployments) { this.ConsensusManager = consensusManager; this.DateTimeProvider = dateTimeProvider; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); this.Mempool = mempool; this.MempoolLock = mempoolLock; this.Network = network; this.nodeDeployments = nodeDeployments; this.Options = minerSettings.BlockDefinitionOptions; this.BlockMinFeeRate = this.Options.BlockMinFeeRate; // Whether we need to account for byte usage (in addition to weight usage). this.NeedSizeAccounting = (this.Options.BlockMaxSize < network.Consensus.Options.MaxBlockSerializedSize); this.Configure(); }
/// <summary> /// Initializes an instance of the object from the node configuration. /// </summary> /// <param name="nodeSettings">The node configuration.</param> public MinerSettings(NodeSettings nodeSettings) { Guard.NotNull(nodeSettings, nameof(nodeSettings)); this.logger = nodeSettings.LoggerFactory.CreateLogger(typeof(MinerSettings).FullName); TextFileConfiguration config = nodeSettings.ConfigReader; this.Mine = config.GetOrDefault <bool>("mine", false, this.logger); if (this.Mine) { this.MineAddress = config.GetOrDefault <string>("mineaddress", null, this.logger); } this.Stake = config.GetOrDefault <bool>("stake", false, this.logger); if (this.Stake) { this.WalletName = config.GetOrDefault <string>("walletname", null, this.logger); this.WalletPassword = config.GetOrDefault <string>("walletpassword", null); // No logging! } uint blockMaxSize = (uint)config.GetOrDefault <int>("blockmaxsize", (int)nodeSettings.Network.Consensus.Options.MaxBlockSerializedSize, this.logger); uint blockMaxWeight = (uint)config.GetOrDefault <int>("blockmaxweight", (int)nodeSettings.Network.Consensus.Options.MaxBlockWeight, this.logger); int blockmintxfee = config.GetOrDefault <int>("blockmintxfee", (int)nodeSettings.Network.Consensus.Options.MinBlockFeeRate, this.logger); this.BlockDefinitionOptions = new BlockDefinitionOptions(blockMaxWeight, blockMaxSize, blockmintxfee).RestrictForNetwork(nodeSettings.Network); this.EnableCoinStakeSplitting = config.GetOrDefault("enablecoinstakesplitting", true, this.logger); this.MinimumSplitCoinValue = config.GetOrDefault("minimumsplitcoinvalue", MinimumSplitCoinValueDefaultValue, this.logger); this.MinimumStakingCoinValue = config.GetOrDefault("minimumstakingcoinvalue", MinimumStakingCoinValueDefaultValue, this.logger); this.MinimumStakingCoinValue = this.MinimumStakingCoinValue == 0 ? 1 : this.MinimumStakingCoinValue; this.EnforceStakingFlag = config.GetOrDefault("enforceStakingFlag", false, this.logger); }
public PowBlockDefinition( IConsensusManager consensusManager, IDateTimeProvider dateTimeProvider, ILoggerFactory loggerFactory, ITxMempool mempool, MempoolSchedulerLock mempoolLock, MinerSettings minerSettings, Network network, IConsensusRuleEngine consensusRules, NodeDeployments nodeDeployments, BlockDefinitionOptions options = null) : base(consensusManager, dateTimeProvider, loggerFactory, mempool, mempoolLock, minerSettings, network, nodeDeployments) { this.consensusRules = consensusRules; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); }