From d405a871a449d13bef9ed16249c8f5aad8f3ca7a Mon Sep 17 00:00:00 2001 From: MoneroOcean Date: Fri, 22 Jan 2021 21:07:24 +0000 Subject: [PATCH] Eth draft support --- index.js | 13 +++++++------ package.json | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 9645f48..6c1bd0f 100644 --- a/index.js +++ b/index.js @@ -55,12 +55,12 @@ function getMerkleRoot(transactions) { let last_epoch_number; let last_seed_hash; -module.exports.baseRavenDiff = function() { - return parseInt('0x00000000ff000000000000000000000000000000000000000000000000000000'); +module.exports.baseDiff = function() { + return bignum('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', 16); }; -module.exports.baseEthDiff = function() { - return parseInt('0x00000000ffff0000000000000000000000000000000000000000000000000000'); +module.exports.baseRavenDiff = function() { + return parseInt('0x00000000ff000000000000000000000000000000000000000000000000000000'); }; module.exports.RavenBlockTemplate = function(rpcData, poolAddress) { @@ -182,10 +182,11 @@ module.exports.constructNewDeroBlob = function(blockTemplate, nonceBuff) { }; module.exports.EthBlockTemplate = function(rpcData) { - const difficulty = parseFloat((module.exports.baseEthDiff() / bignum(rpcData[2].substr(2), 16).toNumber()).toFixed(19)); + const difficulty = (module.exports.baseDiff() / bignum(rpcData[2].substr(2), 16)).toNumber(); return { hash: rpcData[0].substr(2), seed_hash: rpcData[1].substr(2), - difficulty: difficulty + difficulty: difficulty, + height: parseInt(rpcData[3]) }; }; \ No newline at end of file diff --git a/package.json b/package.json index 268a0fb..e3e3f78 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cryptoforknote-util", - "version": "9.1.2", + "version": "9.1.3", "main": "cryptoforknote-util", "author": { "name": "LucasJones",