This commit is contained in:
Benjamin Wilson
2024-07-04 21:03:51 -04:00
parent 522ef126d9
commit 14f95a7fa4
3 changed files with 10 additions and 5 deletions
+4
View File
@@ -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) {
+4 -3
View File
@@ -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)
+2 -2
View File
@@ -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,