mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
logging
This commit is contained in:
@@ -372,7 +372,7 @@ export class StratumV1Client extends EasyUnsubscribe {
|
|||||||
const { submissionDifficulty, submissionHash } = this.calculateDifficulty(header);
|
const { submissionDifficulty, submissionHash } = this.calculateDifficulty(header);
|
||||||
|
|
||||||
console.log(`DIFF: ${submissionDifficulty} of ${this.sessionDifficulty} from ${this.clientAuthorization.worker + '.' + this.extraNonceAndSessionId}`);
|
console.log(`DIFF: ${submissionDifficulty} of ${this.sessionDifficulty} from ${this.clientAuthorization.worker + '.' + this.extraNonceAndSessionId}`);
|
||||||
//console.log(`Header: ${header.toString('hex')}`);
|
|
||||||
|
|
||||||
if (submissionDifficulty >= this.sessionDifficulty) {
|
if (submissionDifficulty >= this.sessionDifficulty) {
|
||||||
|
|
||||||
@@ -413,6 +413,7 @@ export class StratumV1Client extends EasyUnsubscribe {
|
|||||||
eStratumErrorCode.LowDifficultyShare,
|
eStratumErrorCode.LowDifficultyShare,
|
||||||
'Difficulty too low').response();
|
'Difficulty too low').response();
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
console.log(`Header: ${header.toString('hex')}`);
|
||||||
await this.promiseSocket.write(err);
|
await this.promiseSocket.write(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { ClientEntity } from '../ORM/client/client.entity';
|
|||||||
|
|
||||||
const CACHE_SIZE = 30;
|
const CACHE_SIZE = 30;
|
||||||
const TARGET_SUBMISSION_PER_SECOND = 10;
|
const TARGET_SUBMISSION_PER_SECOND = 10;
|
||||||
|
const MIN_DIFF = 1e-9;
|
||||||
export class StratumV1ClientStatistics {
|
export class StratumV1ClientStatistics {
|
||||||
|
|
||||||
private submissionCacheStart: Date;
|
private submissionCacheStart: Date;
|
||||||
@@ -65,10 +66,13 @@ export class StratumV1ClientStatistics {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private nearestPowerOfTwo(val) {
|
private nearestPowerOfTwo(val): number {
|
||||||
if (val === 0) {
|
if (val === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (val < MIN_DIFF) {
|
||||||
|
return MIN_DIFF;
|
||||||
|
}
|
||||||
let x = val | (val >> 1);
|
let x = val | (val >> 1);
|
||||||
x = x | (x >> 2);
|
x = x | (x >> 2);
|
||||||
x = x | (x >> 4);
|
x = x | (x >> 4);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export class StratumV1Service implements OnModuleInit {
|
|||||||
|
|
||||||
const clientCount = await this.clientService.connectedClientCount();
|
const clientCount = await this.clientService.connectedClientCount();
|
||||||
|
|
||||||
console.log(`Client disconnected: ${promiseSocket.socket.remoteAddress}, ${clientCount} total clients`);
|
console.log(`Client disconnected: ${promiseSocket.socket.remoteAddress}, ${client.extraNonceAndSessionId}, ${clientCount} total clients`);
|
||||||
});
|
});
|
||||||
|
|
||||||
promiseSocket.socket.on('error', async (error: Error) => {
|
promiseSocket.socket.on('error', async (error: Error) => {
|
||||||
@@ -77,7 +77,7 @@ export class StratumV1Service implements OnModuleInit {
|
|||||||
|
|
||||||
const clientCount = await this.clientService.connectedClientCount();
|
const clientCount = await this.clientService.connectedClientCount();
|
||||||
console.error(`Socket error:`, error);
|
console.error(`Socket error:`, error);
|
||||||
console.log(`Client disconnected: ${promiseSocket.socket.remoteAddress}, ${clientCount} total clients`);
|
console.log(`Client disconnected: ${promiseSocket.socket.remoteAddress}, ${client.extraNonceAndSessionId}, ${clientCount} total clients`);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user