fix(mining-admin): 修复同步状态判断逻辑
- 同步判断改为只检查全网理论算力是否同步 - 全网理论算力是挖矿分母,是判断同步完成的核心指标 - 使用相对误差(0.1%)而非绝对误差来判断同步 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
9e15fa4fd8
commit
7909bcc3d1
|
|
@ -86,14 +86,14 @@ export class ConfigController {
|
|||
const miningUserTotal = miningData.totalContribution || '0';
|
||||
|
||||
// 判断算力是否同步完成
|
||||
// 条件1:全网理论算力已同步(mining-service 中的 networkTotalContribution > 0)
|
||||
// 条件2:用户有效算力已同步(mining-service 中的 totalContribution 与 contribution-service 相近)
|
||||
const hasNetworkContribution = parseFloat(miningNetworkTotal) > 0;
|
||||
const userSynced = userEffectiveContribution !== null &&
|
||||
parseFloat(userEffectiveContribution) > 0 &&
|
||||
Math.abs(parseFloat(miningUserTotal) - parseFloat(userEffectiveContribution)) < 0.01;
|
||||
// 核心条件:全网理论算力已同步(mining-service 的 networkTotalContribution 与 contribution-service 相近)
|
||||
// 全网理论算力是挖矿分母,必须同步后才能正确计算挖矿比例
|
||||
const networkSynced = networkTotalContribution !== null &&
|
||||
parseFloat(networkTotalContribution) > 0 &&
|
||||
parseFloat(miningNetworkTotal) > 0 &&
|
||||
Math.abs(parseFloat(miningNetworkTotal) - parseFloat(networkTotalContribution)) / parseFloat(networkTotalContribution) < 0.001;
|
||||
|
||||
const isSynced = hasNetworkContribution && userSynced;
|
||||
const isSynced = networkSynced;
|
||||
|
||||
return {
|
||||
...miningData,
|
||||
|
|
|
|||
Loading…
Reference in New Issue