getSuggestedDifficulty bug

This commit is contained in:
Ben Wilson
2023-08-06 22:41:25 -04:00
parent 0a9c254e84
commit 1172ab5971
5 changed files with 38 additions and 36 deletions
+6 -6
View File
@@ -49,14 +49,14 @@ export class StratumV1ClientStatistics {
public getSuggestedDifficulty(clientDifficulty: number) {
// miner hasn't submitted shares in one minute
if (this.submissionCache.length == 0 || (new Date().getTime() - this.submissionCacheStart.getTime()) / 1000 > 60) {
return this.nearestPowerOfTwo(clientDifficulty >> 1);
if (this.submissionCache.length == 0) {
if ((new Date().getTime() - this.submissionCacheStart.getTime()) / 1000 > 60) {
return this.nearestPowerOfTwo(clientDifficulty >> 1);
} else {
return null;
}
}
// if (this.submissionCache.length < CACHE_SIZE) {
// return null;
// }
const sum = this.submissionCache.reduce((pre, cur) => {
pre += cur.difficulty;
return pre;