Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PoolConfig"/> class.
        /// </summary>
        /// <param name="config">The configuration.</param>
        /// <param name="coinConfig"></param>
        public PoolConfig(dynamic config, ICoinConfig coinConfig)
        {
            try
            {
                Enabled = config.enabled ? config.enabled : false;

                if (Enabled == false) // if the configuration is not enabled
                {
                    return;           // just skip reading rest of the parameters.
                }
                Coin = coinConfig;    // assign the coin config.

                // load the sections.
                Daemon   = new DaemonConfig(config.daemon);
                Meta     = new MetaConfig(config.meta);
                Wallet   = new WalletConfig(config.wallet);
                Rewards  = new RewardsConfig(config.rewards);
                Payments = new PaymentConfig(config.payments);
                Miner    = new MinerConfig(config.miner);
                Job      = new JobConfig(config.job);
                Stratum  = new StratumServerConfig(config.stratum);
                Banning  = new BanConfig(config.banning);
                Storage  = new RedisConfig(config.storage.redis);
                Vanilla  = new VanillaServerConfig(config.vanilla);

                Valid = true;
            }
            catch (Exception e)
            {
                Valid = false;
                Log.Logger.ForContext <PoolConfig>().Error(e, "Error loading pool configuration");
            }
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PoolConfig"/> class.
        /// </summary>
        /// <param name="config">The configuration.</param>
        /// <param name="coinConfig"></param>
        public PoolConfig(dynamic config, ICoinConfig coinConfig)
        {
            try
            {
                _logger = Log.ForContext <PoolConfig>().ForContext("Component", coinConfig.Name);

                Enabled = config.enabled ? config.enabled : false;

                if (Enabled == false) // if the configuration is not enabled
                {
                    return;           // just skip reading rest of the parameters.
                }
                Coin = coinConfig;    // assign the coin config.

                // load the sections.
                Daemon   = new DaemonConfig(config.daemon);
                Meta     = new MetaConfig(config.meta);
                Wallet   = new WalletConfig(config.wallet);
                Rewards  = new RewardsConfig(config.rewards);
                Payments = new PaymentConfig(config.payments);
                Miner    = new MinerConfig(config.miner);
                Job      = new JobConfig(config.job);
                Stratum  = new StratumServerConfig(config.stratum);
                Banning  = new BanConfig(config.banning);
                Storage  = new StorageConfig(config.storage);
                Vanilla  = new VanillaServerConfig(config.vanilla);

                // process extra checks
                if (Storage.Layer is MposStorageLayerConfig)
                {
                    if (Payments.Enabled)
                    {
                        Payments.Disable();
                        _logger.Information("Disabled payments processor as it can not be enabled when MPOS mode is on");
                    }
                }

                Valid = true;
            }
            catch (Exception e)
            {
                Valid = false;
                _logger.Error(e, "Error loading pool configuration");
            }
        }