chain: fix getProofTime.
This commit is contained in:
parent
71f8b25d3c
commit
fb8b9fac2b
@ -1928,6 +1928,7 @@ Chain.prototype.getOrphanRoot = function getOrphanRoot(hash) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Chain.prototype.getProofTime = function getProofTime(to, from) {
|
Chain.prototype.getProofTime = function getProofTime(to, from) {
|
||||||
|
var pow = this.network.pow;
|
||||||
var sign, work;
|
var sign, work;
|
||||||
|
|
||||||
if (to.chainwork.cmp(from.chainwork) > 0) {
|
if (to.chainwork.cmp(from.chainwork) > 0) {
|
||||||
@ -1938,8 +1939,8 @@ Chain.prototype.getProofTime = function getProofTime(to, from) {
|
|||||||
sign = -1;
|
sign = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
work = work.imuln(this.network.pow.targetSpacing);
|
work = work.imuln(pow.targetSpacing);
|
||||||
work = work.idiv(this.tip.getProof());
|
work = work.div(this.tip.getProof());
|
||||||
|
|
||||||
if (work.bitLength() > 53)
|
if (work.bitLength() > 53)
|
||||||
return sign * util.MAX_SAFE_INTEGER;
|
return sign * util.MAX_SAFE_INTEGER;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user