From 7909bcc3d1c2f89fad5436aea1453056400ae8bb Mon Sep 17 00:00:00 2001 From: hailin Date: Fri, 16 Jan 2026 04:07:18 -0800 Subject: [PATCH] =?UTF-8?q?fix(mining-admin):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E7=8A=B6=E6=80=81=E5=88=A4=E6=96=AD=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 同步判断改为只检查全网理论算力是否同步 - 全网理论算力是挖矿分母,是判断同步完成的核心指标 - 使用相对误差(0.1%)而非绝对误差来判断同步 Co-Authored-By: Claude Opus 4.5 --- .../src/api/controllers/config.controller.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/services/mining-admin-service/src/api/controllers/config.controller.ts b/backend/services/mining-admin-service/src/api/controllers/config.controller.ts index bed25de2..9a81f28d 100644 --- a/backend/services/mining-admin-service/src/api/controllers/config.controller.ts +++ b/backend/services/mining-admin-service/src/api/controllers/config.controller.ts @@ -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,