Skip to content

Commit

Permalink
bugfix: "Cannot convert undefined to a BigInt error"
Browse files Browse the repository at this point in the history
Update default difficulty value in JobManager constructor
  • Loading branch information
Aoi Emerauda authored and Aoi Emerauda committed Nov 7, 2024
1 parent 2c91b1a commit 66fb793
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/jobManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,13 @@ var JobManager = module.exports = function JobManager(options) {
return shareError([24, `Algorithm properties not found for ${algorithm}`]);
}

var diff1 = BigInt(algoProps.diff) || BigInt('0x00000000ffff0000000000000000000000000000000000000000000000000000');
var diff1;
try {
// Ensure algoProps.diff is defined; if not, set a default value
diff1 = BigInt(algoProps.diff || '0x00000000ffff0000000000000000000000000000000000000000000000000000');
} catch (e) {
return shareError([25, 'Cannot convert diff to BigInt: ' + e.message]);
}
var multiplier = algoProps.multiplier || 1;

var shareDiff = Number(diff1) / Number(headerBigNum) * multiplier;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stratum-pool",
"version": "0.2.6",
"version": "0.2.7",
"description": "High performance Stratum poolserver in Node.js",
"keywords": [
"stratum",
Expand Down

0 comments on commit 66fb793

Please sign in to comment.