fix(contribution): only publish adoptions with contributionDistributed=true
When publishing adoption events to mining-admin-service: - Only include adoptions where contributionDistributed=true (already processed) - Force status to 'MINING_ENABLED' since these are active adoptions This ensures mining-admin-service only counts valid, processed adoptions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
20eabbb85f
commit
1f699fbfe1
|
|
@ -220,7 +220,11 @@ export class AdminController {
|
|||
failedCount: number;
|
||||
message: string;
|
||||
}> {
|
||||
// 只发布已分配算力的认种记录(contributionDistributed = true)
|
||||
const adoptions = await this.prisma.syncedAdoption.findMany({
|
||||
where: {
|
||||
contributionDistributed: true,
|
||||
},
|
||||
select: {
|
||||
originalAdoptionId: true,
|
||||
accountSequence: true,
|
||||
|
|
@ -241,12 +245,13 @@ export class AdminController {
|
|||
try {
|
||||
await this.unitOfWork.executeInTransaction(async () => {
|
||||
const events = batch.map((adoption) => {
|
||||
// 已分配算力的认种记录,status 强制设置为 MINING_ENABLED
|
||||
const event = new AdoptionSyncedEvent(
|
||||
adoption.originalAdoptionId,
|
||||
adoption.accountSequence,
|
||||
adoption.treeCount,
|
||||
adoption.adoptionDate,
|
||||
adoption.status,
|
||||
'MINING_ENABLED',
|
||||
adoption.contributionPerTree.toString(),
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue