fix(mining): calculate remainingDistribution from actual distributed amount

- Changed from reading config.remainingDistribution to calculating:
  remainingDistribution = distributionPool - totalDistributed
- Ensures data consistency: remaining + distributed = total pool
- Added Math.max(0, ...) to prevent negative values

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-17 08:19:05 -08:00
parent 3e536115eb
commit 6043d2fec8
1 changed files with 2 additions and 1 deletions

View File

@ -68,7 +68,8 @@ export class MiningController {
// 计算挖矿进度(用实际已分配数量 / 分配池总量)
const distributionPool = Number(config.distributionPool || 0);
const remainingDistribution = Number(config.remainingDistribution || 0);
// 剩余分配池 = 总池 - 实际已分配(保持数据一致性)
const remainingDistribution = Math.max(0, distributionPool - totalDistributedDecimal);
const miningProgress = distributionPool > 0 ? (totalDistributedDecimal / distributionPool) * 100 : 0;
// 计算剩余分钟数