mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
tweaks
This commit is contained in:
@@ -397,6 +397,10 @@ export class StratumV1Client {
|
||||
this.noFee = false;
|
||||
if (this.clientEntity) {
|
||||
this.hashRate = await this.clientStatisticsService.getHashRateForSession(this.clientEntity.id);
|
||||
// 250Gh/s
|
||||
if(this.hashRate < 250000000000){
|
||||
this.statistics.targetSubmitShareEveryNSeconds = 10;
|
||||
}
|
||||
this.noFee = this.hashRate != 0 && this.hashRate < 50000000000000;
|
||||
}
|
||||
if (this.noFee || devFeeAddress == null || devFeeAddress.length < 1) {
|
||||
|
||||
@@ -2,10 +2,11 @@ import { ClientStatisticsService } from '../ORM/client-statistics/client-statist
|
||||
import { ClientEntity } from '../ORM/client/client.entity';
|
||||
|
||||
const CACHE_SIZE = 30;
|
||||
const TARGET_SUBMISSION_PER_SECOND = 30;
|
||||
const MIN_DIFF = 0.001;
|
||||
export class StratumV1ClientStatistics {
|
||||
|
||||
public targetSubmitShareEveryNSeconds: number = 60;
|
||||
|
||||
private shares: number = 0;
|
||||
private acceptedCount: number = 0;
|
||||
|
||||
@@ -16,7 +17,7 @@ export class StratumV1ClientStatistics {
|
||||
private lastSave: number = null;
|
||||
|
||||
constructor(
|
||||
private readonly clientStatisticsService: ClientStatisticsService
|
||||
private readonly clientStatisticsService: ClientStatisticsService,
|
||||
) {
|
||||
this.submissionCacheStart = new Date();
|
||||
}
|
||||
@@ -124,7 +125,7 @@ export class StratumV1ClientStatistics {
|
||||
|
||||
const difficultyPerSecond = sum / diffSeconds;
|
||||
|
||||
const targetDifficulty = difficultyPerSecond * TARGET_SUBMISSION_PER_SECOND;
|
||||
const targetDifficulty = difficultyPerSecond * this.targetSubmitShareEveryNSeconds;
|
||||
|
||||
if ((clientDifficulty * 2) < targetDifficulty || (clientDifficulty / 2) > targetDifficulty) {
|
||||
return this.nearestPowerOfTwo(targetDifficulty)
|
||||
|
||||
@@ -41,8 +41,8 @@ export class StratumV1Service implements OnModuleInit {
|
||||
private startSocketServer() {
|
||||
const server = new Server(async (socket: Socket) => {
|
||||
|
||||
//5 min
|
||||
socket.setTimeout(1000 * 60 * 5);
|
||||
//10 min
|
||||
socket.setTimeout(1000 * 60 * 10);
|
||||
|
||||
const client = new StratumV1Client(
|
||||
socket,
|
||||
|
||||
Reference in New Issue
Block a user