mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2025-03-27 02:02:10 +01:00
reduce minimum diff
This commit is contained in:
parent
e230e25e91
commit
37a65e43b2
@ -77,7 +77,7 @@ export class StratumV1Client extends EasyUnsubscribe {
|
||||
|
||||
|
||||
private async handleMessage(socket: Socket, message: string) {
|
||||
console.log('Received:', message);
|
||||
//console.log('Received:', message);
|
||||
|
||||
// Parse the message and check if it's the initial subscription message
|
||||
let parsedMessage = null;
|
||||
@ -233,6 +233,7 @@ export class StratumV1Client extends EasyUnsubscribe {
|
||||
let clearJobs = false;
|
||||
if (lastIntervalCount === interValCount) {
|
||||
clearJobs = true;
|
||||
console.log('new block')
|
||||
}
|
||||
lastIntervalCount = interValCount;
|
||||
|
||||
@ -263,7 +264,7 @@ export class StratumV1Client extends EasyUnsubscribe {
|
||||
|
||||
this.socket.write(job.response + '\n');
|
||||
|
||||
|
||||
console.log(`Sent new job to ${this.extraNonce}. (clearJobs: ${clearJobs})`)
|
||||
|
||||
}
|
||||
|
||||
@ -284,7 +285,7 @@ export class StratumV1Client extends EasyUnsubscribe {
|
||||
);
|
||||
const submissionDifficulty = this.calculateDifficulty(updatedJobBlock.toBuffer(true));
|
||||
|
||||
console.log(`DIFF: ${submissionDifficulty} of ${this.sessionDifficulty}`);
|
||||
console.log(`DIFF: ${Math.round(submissionDifficulty)} of ${this.sessionDifficulty} from ${this.clientAuthorization.worker + '.' + this.extraNonce}`);
|
||||
|
||||
if (submissionDifficulty >= this.sessionDifficulty) {
|
||||
|
||||
@ -323,14 +324,16 @@ export class StratumV1Client extends EasyUnsubscribe {
|
||||
method: eResponseMethod.SET_DIFFICULTY,
|
||||
params: [targetDiff]
|
||||
}
|
||||
) + '\n');
|
||||
) + '\n', () => {
|
||||
|
||||
// we need to clear the jobs so that the difficulty set takes effect. Otherwise the different miner implementations can cause issues
|
||||
this.blockTemplateService.currentBlockTemplate$.pipe(take(1)).subscribe(({ blockTemplate }) => {
|
||||
this.sendNewMiningJob(blockTemplate, true);
|
||||
// we need to clear the jobs so that the difficulty set takes effect. Otherwise the different miner implementations can cause issues
|
||||
this.blockTemplateService.currentBlockTemplate$.pipe(take(1)).subscribe(({ blockTemplate }) => {
|
||||
this.sendNewMiningJob(blockTemplate, true);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,18 +63,18 @@ export class StratumV1ClientStatistics {
|
||||
|
||||
}
|
||||
|
||||
private blpo2(x) {
|
||||
x = x | (x >> 1);
|
||||
private blpo2(val) {
|
||||
let x = val | (val >> 1);
|
||||
x = x | (x >> 2);
|
||||
x = x | (x >> 4);
|
||||
x = x | (x >> 8);
|
||||
x = x | (x >> 16);
|
||||
x = x | (x >> 32);
|
||||
const val = x - (x >> 1);
|
||||
if (val < 1) {
|
||||
return 1;
|
||||
const res = x - (x >> 1);
|
||||
if (res < 1) {
|
||||
return this.blpo2(val * 100) / 100;
|
||||
}
|
||||
return val;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user