chain: fix getProofTime.

This commit is contained in:
Christopher Jeffrey 2017-06-16 00:07:50 -07:00
parent 71f8b25d3c
commit fb8b9fac2b
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -1928,6 +1928,7 @@ Chain.prototype.getOrphanRoot = function getOrphanRoot(hash) {
*/
Chain.prototype.getProofTime = function getProofTime(to, from) {
var pow = this.network.pow;
var sign, work;
if (to.chainwork.cmp(from.chainwork) > 0) {
@ -1938,8 +1939,8 @@ Chain.prototype.getProofTime = function getProofTime(to, from) {
sign = -1;
}
work = work.imuln(this.network.pow.targetSpacing);
work = work.idiv(this.tip.getProof());
work = work.imuln(pow.targetSpacing);
work = work.div(this.tip.getProof());
if (work.bitLength() > 53)
return sign * util.MAX_SAFE_INTEGER;