block: change exponent offset to avoid subtraction
This commit is contained in:
parent
29316a2fbc
commit
35bbe11055
1 changed files with 2 additions and 2 deletions
|
@ -131,11 +131,11 @@ Block.prototype.toHex = function (headersOnly) {
|
||||||
Block.calculateTarget = function (bits) {
|
Block.calculateTarget = function (bits) {
|
||||||
var exponent = ((bits & 0xff000000) >> 24) - 3
|
var exponent = ((bits & 0xff000000) >> 24) - 3
|
||||||
var mantissa = bits & 0x007fffff
|
var mantissa = bits & 0x007fffff
|
||||||
var i = 31 - exponent
|
var i = 28 - exponent
|
||||||
|
|
||||||
var target = new Buffer(32)
|
var target = new Buffer(32)
|
||||||
target.fill(0)
|
target.fill(0)
|
||||||
target.writeUInt32BE(mantissa, i - 3)
|
target.writeUInt32BE(mantissa, i)
|
||||||
return target
|
return target
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue