Fix Block to allow regtest target (easiest possible target)
This commit is contained in:
parent
f57a73496d
commit
7c0e02ad48
2 changed files with 5 additions and 1 deletions
|
@ -145,7 +145,7 @@ Block.calculateTarget = function (bits) {
|
||||||
const exponent = ((bits & 0xff000000) >> 24) - 3
|
const exponent = ((bits & 0xff000000) >> 24) - 3
|
||||||
const mantissa = bits & 0x007fffff
|
const mantissa = bits & 0x007fffff
|
||||||
const target = Buffer.alloc(32, 0)
|
const target = Buffer.alloc(32, 0)
|
||||||
target.writeUInt32BE(mantissa, 28 - exponent)
|
target.writeUIntBE(mantissa, 29 - exponent, 3)
|
||||||
return target
|
return target
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
test/fixtures/block.json
vendored
4
test/fixtures/block.json
vendored
|
@ -19,6 +19,10 @@
|
||||||
{
|
{
|
||||||
"bits": "cffca00",
|
"bits": "cffca00",
|
||||||
"expected": "00000000000000000000000000000000000000007fca00000000000000000000"
|
"expected": "00000000000000000000000000000000000000007fca00000000000000000000"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bits": "207fffff",
|
||||||
|
"expected": "7fffff0000000000000000000000000000000000000000000000000000000000"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"valid": [
|
"valid": [
|
||||||
|
|
Loading…
Reference in a new issue