Ejemplo n.º 1
0
 public X1PowMining(
     IAsyncProvider asyncProvider,
     IBlockProvider blockProvider,
     IConsensusManager consensusManager,
     ChainIndexer chainIndexer,
     IDateTimeProvider dateTimeProvider,
     ITxMempool mempool,
     MempoolSchedulerLock mempoolLock,
     Network network,
     INodeLifetime nodeLifetime,
     ILoggerFactory loggerFactory,
     IInitialBlockDownloadState initialBlockDownloadState,
     MinerSettings minerSettings)
 {
     this.asyncProvider             = asyncProvider;
     this.blockProvider             = blockProvider;
     this.chainIndexer              = chainIndexer;
     this.consensusManager          = consensusManager;
     this.dateTimeProvider          = dateTimeProvider;
     this.loggerFactory             = loggerFactory;
     this.initialBlockDownloadState = initialBlockDownloadState;
     this.logger       = loggerFactory.CreateLogger(this.GetType().FullName);
     this.mempool      = mempool;
     this.mempoolLock  = mempoolLock;
     this.network      = network;
     this.nodeLifetime = nodeLifetime;
     this.miningCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(new[] { this.nodeLifetime.ApplicationStopping });
     this.minerSettings = (X1MinerSettings)minerSettings;
     if (this.minerSettings.UseOpenCL)
     {
         this.openCLMiner = new OpenCLMiner(this.minerSettings, loggerFactory);
     }
 }
Ejemplo n.º 2
0
 public X1MiningFeature(
     ConnectionManagerSettings connectionManagerSettings,
     Network network,
     MinerSettings minerSettings,
     NodeSettings nodeSettings,
     ILoggerFactory loggerFactory,
     ITimeSyncBehaviorState timeSyncBehaviorState,
     IPowMining powMining,
     IPosMinting posMinting = null)
 {
     this.connectionManagerSettings = connectionManagerSettings;
     this.network               = network;
     this.minerSettings         = (X1MinerSettings)minerSettings;
     this.nodeSettings          = nodeSettings;
     this.powMining             = powMining;
     this.timeSyncBehaviorState = timeSyncBehaviorState;
     this.posMinting            = posMinting;
     this.logger = loggerFactory.CreateLogger(this.GetType().FullName);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a new OpenCLMiner instance.
        /// </summary>
        /// <param name="minerSettings">the minerSettings</param>
        /// <param name="loggerFactory">the loggerFactory</param>
        public OpenCLMiner(X1MinerSettings minerSettings, ILoggerFactory loggerFactory)
        {
            this.logger = loggerFactory.CreateLogger(this.GetType().FullName);
            var devices = ComputePlatform.Platforms.SelectMany(p => p.Devices).Where(d => d.Available && d.CompilerAvailable).ToList();

            if (!devices.Any())
            {
                this.logger.LogWarning($"No OpenCL Devices Found!");
            }
            else
            {
                foreach (ComputeDevice device in devices)
                {
                    this.logger.LogInformation($"Found OpenCL Device: Name={device.Name}, MaxClockFrequency{device.MaxClockFrequency}");
                }

                this.computeDevice = devices.FirstOrDefault(d => d.Name.Equals(minerSettings.OpenCLDevice, StringComparison.OrdinalIgnoreCase)) ?? devices.FirstOrDefault();
                if (this.computeDevice != null)
                {
                    this.logger.LogInformation($"Using OpenCL Device: Name={this.computeDevice.Name}");
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Get the default configuration.
 /// </summary>
 /// <param name="builder">The string builder to add the settings to.</param>
 /// <param name="network">The network to base the defaults off.</param>
 public static void BuildDefaultConfigurationFile(StringBuilder builder, Network network)
 {
     X1MinerSettings.BuildDefaultConfigurationFile(builder, network);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Prints command-line help.
 /// </summary>
 /// <param name="network">The network to extract values from.</param>
 public static void PrintHelp(Network network)
 {
     X1MinerSettings.PrintHelp(network);
 }