// 算力统计 static public void SetDT(Block myblk, Block preblk, HttpPool httpRule) { if (httpRule == null || myblk == null || preblk == null) { return; } Dictionary <string, MinerTask> miners = httpRule?.GetMiner(preblk.height); if (miners == null) { return; } //double difftotal = 0; //foreach (var miner in miners.Values) //{ // if (double.TryParse(miner.power_average, out double diff)) { // difftotal += diff; // } //} double difftotal = miners.Values.Sum(x => x.power); if (difftotal != 0) { if (myblk.extend == null) { myblk.extend = new Dictionary <int, string>(); } myblk.extend.Add(1, "" + difftotal); } }
public override void Awake(JToken jd = null) { style = jd["style"]?.ToString(); float.TryParse(jd["serviceFee"]?.ToString(), out serviceFee); serviceFee = MathF.Max(0, MathF.Min(1, serviceFee)); if (style == "PPLNS") { string db_path = jd["db_path"]?.ToString(); var DatabasePath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), db_path); PoolDBStore.Init(DatabasePath); } if (jd["OutTimeDBMiner"] != null) { long.TryParse(jd["OutTimeDBMiner"]?.ToString(), out OutTimeDBMiner); } if (jd["OutTimeDBCounted"] != null) { long.TryParse(jd["OutTimeDBCounted"]?.ToString(), out OutTimeDBCounted); } if (jd["RewardInterval"] != null) { long.TryParse(jd["RewardInterval"]?.ToString(), out RewardInterval); } httpPool = Entity.Root.GetComponentInChild <HttpPool>(); transferProcess = Entity.Root.AddComponent <TransferProcess>(); }
public override void Start() { consensus = Entity.Root.GetComponent <Consensus>(); blockMgr = Entity.Root.GetComponent <BlockMgr>(); httpPool = Entity.Root.GetComponentInChild <HttpPool>(); nodeManager = Entity.Root.GetComponent <NodeManager>(); if (bRun) { Run(); } }
public override void Awake(JToken jd = null) { string db_path = jd["db_path"]?.ToString(); var DatabasePath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), db_path); PoolDBStore.Init(DatabasePath); style = jd["style"]?.ToString(); float.TryParse(jd["serviceFee"]?.ToString(), out serviceFee); serviceFee = MathF.Max(0, MathF.Min(0.3f, serviceFee)); if (jd["registerPool"] != null) { bool.TryParse(jd["registerPool"]?.ToString(), out registerPool); } if (jd["OutTimeDBMiner"] != null) { long.TryParse(jd["OutTimeDBMiner"]?.ToString(), out OutTimeDBMiner); } if (jd["OutTimeDBCounted"] != null) { long.TryParse(jd["OutTimeDBCounted"]?.ToString(), out OutTimeDBCounted); } if (jd["RewardInterval"] != null) { long.TryParse(jd["RewardInterval"]?.ToString(), out RewardInterval); } if (registerPool) { Log.Info($"Pool.registerPool=true --> Pool.style=SOLO"); style = "SOLO"; RewardInterval = Math.Max(8, Math.Min(32, RewardInterval)); } else if (style == "PPLNS") { #if RELEASE RewardInterval = Math.Max(120, Math.Min(240 * 24, RewardInterval)); #else RewardInterval = Math.Max(32, RewardInterval); #endif } Log.Info($"HttpPool.style = {style}"); Log.Info($"HttpPool.registerPool = {registerPool}"); Log.Info($"HttpPool.RewardInterval = {RewardInterval}"); httpPool = Entity.Root.GetComponentInChild <HttpPool>(); transferProcess = Entity.Root.AddComponent <TransferProcess>(); }
public async override void Start() { timePass1 = new TimePass(0.1f); timePass2 = new TimePass(0.1f); pool = Entity.Root.GetComponentInChild <Pool>(); httpPool = Entity.Root.GetComponentInChild <HttpPool>(); httpRpc = Entity.Root.GetComponentInChild <HttpRpc>(); pool.transferProcess.rulerRpc = rulerRpc; System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(RunRegisterPool)); thread.IsBackground = true;//设置为后台线程 thread.Priority = System.Threading.ThreadPriority.Normal; thread.Start(this); await Task.Delay(3000); Run(); }
public override void Start() { httpPool = Entity.Root.GetComponentInChild <HttpPool>(); Run(); }
public override void Awake(JToken jd = null) { httpPool = Entity.Root.GetComponentInChild <HttpPool>(); }