From ed838edadab0077c8816bc0732f1c70f667fc8cd Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 24 Jul 2024 20:46:54 +0800 Subject: [PATCH] added deadline. --- src/nova/nova.balance.service.ts | 7 ++++++- src/nova/nova.controller.ts | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/nova/nova.balance.service.ts b/src/nova/nova.balance.service.ts index de6f5b7..16491b4 100644 --- a/src/nova/nova.balance.service.ts +++ b/src/nova/nova.balance.service.ts @@ -701,13 +701,18 @@ export class NovaBalanceService extends Worker { data: { address: string; point: number }[], signature, batchString, + deadline, ): Promise { - const message = "supplementPoint"; + const message = `supplementPoint${deadline}`; const address = "0xfb5eb3d27128a9dde885304e2653c41396e36662"; const valid = await this.validatePrivatekey(address, message, signature); if (!valid) { return false; } + const now = new Date().getTime(); + if (now > deadline * 1000) { + return false; + } await this.supplementPointRepository.addManyDirectPoint(data, batchString); return true; } diff --git a/src/nova/nova.controller.ts b/src/nova/nova.controller.ts index a25114f..727e260 100644 --- a/src/nova/nova.controller.ts +++ b/src/nova/nova.controller.ts @@ -685,6 +685,7 @@ export class NovaController { public async uploadSupplementPoints( @Query("signature") signature: string, @Query("batchString") batchString: string, + @Query("deadline") deadline: number, @Body() data: { address: string; @@ -697,6 +698,7 @@ export class NovaController { data, signature, batchString, + deadline, ); } catch (error) { this.logger.error("Upload supplement points failed", error.stack);