Skip to content

Commit c01343b

Browse files
committed
Cleans up distribution.service & removes unused dependency
1 parent 0edb78a commit c01343b

3 files changed

Lines changed: 9 additions & 24 deletions

File tree

package-lock.json

Lines changed: 2 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
"base64url": "^3.0.1",
3939
"bn.js": "^5.2.1",
4040
"consul": "^2.0.1",
41-
"date-fns": "^4.1.0",
4241
"ethers": "^6.13.4",
4342
"h3-js": "^4.1.0",
4443
"keccak": "^3.0.4",

src/distribution/distribution.service.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Inject, Injectable, Logger } from '@nestjs/common'
1+
import { Injectable, Logger } from '@nestjs/common'
22
import { ScoreData } from './schemas/score-data'
33
import { ConfigService } from '@nestjs/config'
44
import _ from 'lodash'
@@ -12,11 +12,8 @@ import { RelayInfo } from './interfaces/8_3/relay-info'
1212
import { DetailsResponse } from './interfaces/8_3/details-response'
1313
import { OperatorRegistryService } from 'src/operator-registry/operator-registry.service'
1414
import { TasksService } from 'src/tasks/tasks.service'
15-
import { InjectModel } from '@nestjs/mongoose'
16-
import { Model } from 'mongoose'
17-
import { differenceInDays, startOfDay, subDays } from 'date-fns'
1815
import { BundlingService } from '../bundling/bundling.service'
19-
import { ethers, lock } from 'ethers'
16+
import { ethers } from 'ethers'
2017

2118
@Injectable()
2219
export class DistributionService {
@@ -140,7 +137,7 @@ export class DistributionService {
140137
const operatorRegistryState = await this.operatorRegistryService.getOperatorRegistryState()
141138
const verificationData = operatorRegistryState.VerifiedFingerprintsToOperatorAddresses
142139
const isHardware = operatorRegistryState.VerifiedHardwareFingerprints
143-
140+
144141
const data: { [key: string]: {
145142
expected: number,
146143
running: number,
@@ -157,7 +154,7 @@ export class DistributionService {
157154
data[pVA].expected = data[pVA].expected + 1
158155
}
159156
})
160-
157+
161158
relaysData.forEach(relay => {
162159
const verifiedAddress = verificationData[relay.fingerprint]
163160
if (verifiedAddress && verifiedAddress.length > 0) {
@@ -166,8 +163,8 @@ export class DistributionService {
166163

167164
if ((
168165
isHardware[relay.fingerprint] ||
169-
(locksData[relay.fingerprint] && locksData[relay.fingerprint].includes(pVA))
170-
) &&
166+
(locksData[relay.fingerprint] && locksData[relay.fingerprint].includes(pVA))
167+
) &&
171168
relay.running && relay.consensus_weight > this.minHealthyConsensusWeight) {
172169
data[pVA].running = data[pVA].running + 1
173170
}
@@ -217,7 +214,7 @@ export class DistributionService {
217214
Network: data,
218215
Locks: locksCount
219216
}
220-
217+
221218
if (this.isLive !== 'true') {
222219
this.logger.warn(`NOT LIVE: Not storing staking/snapshot [${stamp}]`)
223220
} else {

0 commit comments

Comments
 (0)