hd.js: workaround for latest bn.js.

This commit is contained in:
Christopher Jeffrey 2015-12-05 18:19:52 -08:00
parent 1a2fefa3d9
commit 3f2d53b414

View File

@ -324,7 +324,11 @@ HDPriv.prototype.derive = function(index, hard) {
// XXX This causes a call stack overflow with bn.js@4.0.5 and elliptic@3.0.3
// Example: new bn(0).mod(ec.curve.n)
var privateKey = leftPart.add(new bn(this.privateKey)).mod(ec.curve.n).toArray();
//var privateKey = leftPart.add(new bn(this.privateKey)).mod(ec.curve.n).toArray();
// Use this as a workaround:
var n = new bn('fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141', 'hex');
var privateKey = leftPart.add(new bn(this.privateKey)).mod(n).toArray();
return new HDPriv({
// version: this.version,