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;
|
failedCount: number;
|
||||||
message: string;
|
message: string;
|
||||||
}> {
|
}> {
|
||||||
|
// 只发布已分配算力的认种记录(contributionDistributed = true)
|
||||||
const adoptions = await this.prisma.syncedAdoption.findMany({
|
const adoptions = await this.prisma.syncedAdoption.findMany({
|
||||||
|
where: {
|
||||||
|
contributionDistributed: true,
|
||||||
|
},
|
||||||
select: {
|
select: {
|
||||||
originalAdoptionId: true,
|
originalAdoptionId: true,
|
||||||
accountSequence: true,
|
accountSequence: true,
|
||||||
|
|
@ -241,12 +245,13 @@ export class AdminController {
|
||||||
try {
|
try {
|
||||||
await this.unitOfWork.executeInTransaction(async () => {
|
await this.unitOfWork.executeInTransaction(async () => {
|
||||||
const events = batch.map((adoption) => {
|
const events = batch.map((adoption) => {
|
||||||
|
// 已分配算力的认种记录,status 强制设置为 MINING_ENABLED
|
||||||
const event = new AdoptionSyncedEvent(
|
const event = new AdoptionSyncedEvent(
|
||||||
adoption.originalAdoptionId,
|
adoption.originalAdoptionId,
|
||||||
adoption.accountSequence,
|
adoption.accountSequence,
|
||||||
adoption.treeCount,
|
adoption.treeCount,
|
||||||
adoption.adoptionDate,
|
adoption.adoptionDate,
|
||||||
adoption.status,
|
'MINING_ENABLED',
|
||||||
adoption.contributionPerTree.toString(),
|
adoption.contributionPerTree.toString(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue