This commit is contained in:
Ben Wilson
2023-06-23 16:32:33 -04:00
parent b9a631c29c
commit b963eaa514
4 changed files with 4 additions and 9 deletions
+3 -1
View File
@@ -25,6 +25,7 @@ export class AppController {
name: worker.clientAuthorization.worker, name: worker.clientAuthorization.worker,
bestDifficulty: Math.floor(worker.statistics.bestDifficulty), bestDifficulty: Math.floor(worker.statistics.bestDifficulty),
hashRate: Math.floor(worker.statistics.getHashRate()), hashRate: Math.floor(worker.statistics.getHashRate()),
startTime: worker.startTime
} }
}) })
} }
@@ -37,7 +38,8 @@ export class AppController {
id: worker.id, id: worker.id,
name: worker.clientAuthorization.worker, name: worker.clientAuthorization.worker,
bestDifficulty: Math.floor(worker.statistics.bestDifficulty), bestDifficulty: Math.floor(worker.statistics.bestDifficulty),
hashData: worker.statistics.historicSubmissions hashData: worker.statistics.historicSubmissions,
startTime: worker.startTime
} }
} }
} }
@@ -95,9 +95,6 @@ export class MiningSubmitMessage extends StratumBaseMessage {
header.writeBigUint64LE(BigInt(job.nbits), 72); header.writeBigUint64LE(BigInt(job.nbits), 72);
header.writeUInt32LE(nonce, 76); header.writeUInt32LE(nonce, 76);
console.log(header.toString('hex'))
const hashBuffer: Buffer = crypto.createHash('sha256').update(header).digest(); const hashBuffer: Buffer = crypto.createHash('sha256').update(header).digest();
const hashResult: Buffer = crypto.createHash('sha256').update(hashBuffer).digest(); const hashResult: Buffer = crypto.createHash('sha256').update(hashBuffer).digest();
@@ -12,8 +12,6 @@ export class SubscriptionMessage extends StratumBaseMessage {
constructor() { constructor() {
super(); super();
this.method = eRequestMethod.SUBSCRIBE; this.method = eRequestMethod.SUBSCRIBE;
console.log('constructor SubscriptionMessage');
} }
public response(clientId: string) { public response(clientId: string) {
+1 -3
View File
@@ -42,10 +42,8 @@ export class StratumV1Service implements OnModuleInit {
}); });
socket.on('error', (error: Error) => { socket.on('error', (error: Error) => {
// Handle socket error // Handle socket error, usually a reset?
console.error(`Socket error:`, error); console.error(`Socket error:`, error);
this.clients = this.clients.filter(c => c.id == client.id);
console.log(`Client disconnected: ${socket.remoteAddress}, ${this.clients.length} total clients`);
}); });
}).listen(3333, () => { }).listen(3333, () => {