We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f57a734 + 7c0e02a commit 2823cd6Copy full SHA for 2823cd6
src/block.js
@@ -145,7 +145,7 @@ Block.calculateTarget = function (bits) {
145
const exponent = ((bits & 0xff000000) >> 24) - 3
146
const mantissa = bits & 0x007fffff
147
const target = Buffer.alloc(32, 0)
148
- target.writeUInt32BE(mantissa, 28 - exponent)
+ target.writeUIntBE(mantissa, 29 - exponent, 3)
149
return target
150
}
151
test/fixtures/block.json
@@ -19,6 +19,10 @@
19
{
20
"bits": "cffca00",
21
"expected": "00000000000000000000000000000000000000007fca00000000000000000000"
22
+ },
23
+ {
24
+ "bits": "207fffff",
25
+ "expected": "7fffff0000000000000000000000000000000000000000000000000000000000"
26
27
],
28
"valid": [
0 commit comments