fix(batch-mining): 修正70%比例计算逻辑
- 移除 PERSONAL_RATE,避免70%被乘两次 - 用户算力 = 棵数 × 22617(不再乘70%) - 全网算力 = 用户算力 / 0.7(70%体现在这里) - 预期结果:(1000000/365/2)*70%*74 = 70958.90411 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
e79d42db61
commit
97b3a20a7c
|
|
@ -88,10 +88,9 @@ export interface BatchMiningPreviewResult {
|
|||
|
||||
// 常量
|
||||
const BASE_CONTRIBUTION_PER_TREE = new Decimal('22617'); // 每棵树的基础算力
|
||||
const PERSONAL_RATE = new Decimal('0.70'); // 个人算力占比 70%
|
||||
const SECONDS_PER_DAY = 86400;
|
||||
// 批量补发用户占全网算力的比例(这些用户只占全网的70%,还有30%是其他用户)
|
||||
const BATCH_USERS_NETWORK_RATIO = new Decimal('0.70');
|
||||
// 用户算力占全网算力的比例(用户占70%,30%是系统、运营、层级、团队的)
|
||||
const USER_NETWORK_RATIO = new Decimal('0.70');
|
||||
|
||||
/**
|
||||
* 挖矿阶段信息
|
||||
|
|
@ -237,13 +236,13 @@ export class BatchMiningService {
|
|||
const batchResults: BatchMiningPreviewResult['batches'] = [];
|
||||
|
||||
// 计算累计全网算力(最终状态)
|
||||
// 这些用户只占全网的70%,所以全网算力 = 用户算力 / 0.7
|
||||
// 用户只占全网的70%(30%是系统、运营、层级、团队),所以全网算力 = 用户算力 / 0.7
|
||||
let totalUserContribution = new Decimal(0);
|
||||
for (const contribution of batchContributions.values()) {
|
||||
totalUserContribution = totalUserContribution.plus(contribution);
|
||||
}
|
||||
const finalNetworkContribution = totalUserContribution.dividedBy(BATCH_USERS_NETWORK_RATIO);
|
||||
this.logger.log(`[preview] 用户总算力: ${totalUserContribution.toFixed(2)}, 全网算力(70%): ${finalNetworkContribution.toFixed(2)}`);
|
||||
const finalNetworkContribution = totalUserContribution.dividedBy(USER_NETWORK_RATIO);
|
||||
this.logger.log(`[preview] 用户总算力: ${totalUserContribution.toFixed(2)}, 全网算力(用户占70%): ${finalNetworkContribution.toFixed(2)}`);
|
||||
|
||||
for (const batchNum of sortedBatches) {
|
||||
const batchItems = batchGroups.get(batchNum)!;
|
||||
|
|
@ -375,8 +374,8 @@ export class BatchMiningService {
|
|||
participatingContribution = participatingContribution.plus(batchContributions.get(batch) || 0);
|
||||
}
|
||||
// 实际全网算力 = 参与用户算力 / 用户占比
|
||||
// 因为这些用户只占全网的70%,所以全网算力 = 用户算力 / 0.7
|
||||
const networkContribution = participatingContribution.dividedBy(BATCH_USERS_NETWORK_RATIO);
|
||||
// 因为用户只占全网的70%(30%是系统、运营、层级、团队),所以全网算力 = 用户算力 / 0.7
|
||||
const networkContribution = participatingContribution.dividedBy(USER_NETWORK_RATIO);
|
||||
|
||||
phases.push({
|
||||
phaseNumber: currentPhase,
|
||||
|
|
@ -402,7 +401,7 @@ export class BatchMiningService {
|
|||
participatingContribution = participatingContribution.plus(batchContributions.get(batch) || 0);
|
||||
}
|
||||
// 实际全网算力 = 参与用户算力 / 用户占比
|
||||
const networkContribution = participatingContribution.dividedBy(BATCH_USERS_NETWORK_RATIO);
|
||||
const networkContribution = participatingContribution.dividedBy(USER_NETWORK_RATIO);
|
||||
|
||||
phases.push({
|
||||
phaseNumber: currentPhase,
|
||||
|
|
@ -716,12 +715,11 @@ export class BatchMiningService {
|
|||
}
|
||||
|
||||
/**
|
||||
* 计算用户算力(70% 个人部分)
|
||||
* 用户算力 = 认种棵数 × 基础算力/棵 × 70%
|
||||
* 计算用户算力
|
||||
* 用户算力 = 认种棵数 × 基础算力/棵
|
||||
* 注意:70%的比例在全网算力计算时体现(用户算力/0.7=全网算力)
|
||||
*/
|
||||
private calculateUserContribution(treeCount: number): Decimal {
|
||||
return BASE_CONTRIBUTION_PER_TREE
|
||||
.times(treeCount)
|
||||
.times(PERSONAL_RATE);
|
||||
return BASE_CONTRIBUTION_PER_TREE.times(treeCount);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue