block: use writeUInt32BE for target calculation
This commit is contained in:
parent
d89bd58346
commit
29316a2fbc
2 changed files with 3 additions and 7 deletions
|
@ -135,12 +135,7 @@ Block.calculateTarget = function (bits) {
|
||||||
|
|
||||||
var target = new Buffer(32)
|
var target = new Buffer(32)
|
||||||
target.fill(0)
|
target.fill(0)
|
||||||
|
target.writeUInt32BE(mantissa, i - 3)
|
||||||
target[i] = mantissa & 0xff
|
|
||||||
target[i - 1] = mantissa >> 8
|
|
||||||
target[i - 2] = mantissa >> 16
|
|
||||||
target[i - 3] = mantissa >> 24
|
|
||||||
|
|
||||||
return target
|
return target
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,8 @@ function stealthDualSend (e, R, Q) {
|
||||||
function stealthDualScan (d, R, eG) {
|
function stealthDualScan (d, R, eG) {
|
||||||
var eQ = eG.multiply(d) // shared secret
|
var eQ = eG.multiply(d) // shared secret
|
||||||
var c = bigi.fromBuffer(bitcoin.crypto.sha256(eQ.getEncoded()))
|
var c = bigi.fromBuffer(bitcoin.crypto.sha256(eQ.getEncoded()))
|
||||||
var vG = new bitcoin.ECPair(null, R.add(G.multiply(c)))
|
var cG = G.multiply(c)
|
||||||
|
var vG = new bitcoin.ECPair(null, R.add(cG))
|
||||||
|
|
||||||
return vG
|
return vG
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue