Skip to content

Commit 49ed205

Browse files
committed
feat: fix block in past
1 parent 5b932eb commit 49ed205

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/events/rewards/rewards.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ export class RewardsService {
136136

137137
protected async getHoursAgoBlock(hours: number) {
138138
const currentBlock = await this.provider.getBlockNumber();
139-
return currentBlock - Math.ceil((hours * 60 * 60) / SECONDS_PER_SLOT);
139+
const blockInPast = currentBlock - Math.ceil((hours * 60 * 60) / SECONDS_PER_SLOT);
140+
return Math.max(blockInPast, 0);
140141
}
141142

142143
protected async getElRewards(fromBlock: number): Promise<BigNumber> {

0 commit comments

Comments
 (0)