Fixed nodejs deprecation issue

master
Harald Wolff 2017-09-16 17:41:26 +02:00
parent a042317739
commit c5ba8facb9
1 changed files with 4 additions and 4 deletions

View File

@ -16,6 +16,8 @@ require('./exceptionWriter.js')(logSystem);
var apiInterfaces = require('./apiInterfaces.js')(config.daemon, config.wallet, config.api);
var utils = require('./utils.js');
Buffer.prototype.toByteArray = function () { return Array.prototype.slice.call(this, 0) }
var log = function(severity, system, text, data){
global.log(severity, system, threadId + text, data);
};
@ -278,8 +280,7 @@ Miner.prototype = {
diffBuff.copy(padded, 32 - diffBuff.length);
var buff = padded.slice(0, 4);
var buffArray = buff.toJSON();
buffArray.reverse();
var buffArray = buff.toByteArray().reverse();
var buffReversed = new Buffer(buffArray);
this.target = buffReversed.readUInt32BE(0);
var hex = buffReversed.toString('hex');
@ -410,8 +411,7 @@ function processShare(miner, job, blockTemplate, nonce, resultHash){
return false;
}
var hashArray = hash.toJSON();
hashArray.reverse();
var hashArray = hash.toByteArray().reverse();
var hashNum = bignum.fromBuffer(new Buffer(hashArray));
var hashDiff = diff1.div(hashNum);