mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
stratum service should be singleton
This commit is contained in:
+3
-1
@@ -17,6 +17,7 @@ import { BitcoinRpcService } from './services/bitcoin-rpc.service';
|
||||
import { CleanupService } from './services/cleanup.service';
|
||||
import { DiscordService } from './services/discord.service';
|
||||
import { NotificationService } from './services/notification.service';
|
||||
import { StratumV1JobsService } from './services/stratum-v1-jobs.service';
|
||||
import { StratumV1Service } from './services/stratum-v1.service';
|
||||
import { TelegramService } from './services/telegram.service';
|
||||
|
||||
@@ -56,7 +57,8 @@ const ORMModules = [
|
||||
TelegramService,
|
||||
BitcoinRpcService,
|
||||
NotificationService,
|
||||
BitcoinAddressValidator
|
||||
BitcoinAddressValidator,
|
||||
StratumV1JobsService
|
||||
],
|
||||
})
|
||||
export class AppModule {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import * as bitcoinjs from 'bitcoinjs-lib';
|
||||
import * as merkle from 'merkle-lib';
|
||||
import * as merkleProof from 'merkle-lib/proof';
|
||||
@@ -20,6 +21,7 @@ export interface IJobTemplate {
|
||||
};
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class StratumV1JobsService {
|
||||
|
||||
private lastIntervalCount: number;
|
||||
|
||||
@@ -15,14 +15,17 @@ import { StratumV1JobsService } from './stratum-v1-jobs.service';
|
||||
@Injectable()
|
||||
export class StratumV1Service implements OnModuleInit {
|
||||
|
||||
private
|
||||
constructor(
|
||||
private readonly bitcoinRpcService: BitcoinRpcService,
|
||||
private readonly clientService: ClientService,
|
||||
private readonly clientStatisticsService: ClientStatisticsService,
|
||||
private readonly notificationService: NotificationService,
|
||||
private readonly blocksService: BlocksService,
|
||||
private readonly configService: ConfigService
|
||||
private readonly configService: ConfigService,
|
||||
private readonly stratumV1JobsService: StratumV1JobsService
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +44,7 @@ export class StratumV1Service implements OnModuleInit {
|
||||
|
||||
const client = new StratumV1Client(
|
||||
promiseSocket,
|
||||
new StratumV1JobsService(this.bitcoinRpcService),
|
||||
this.stratumV1JobsService,
|
||||
this.bitcoinRpcService,
|
||||
this.clientService,
|
||||
this.clientStatisticsService,
|
||||
|
||||
Reference in New Issue
Block a user