Fix wrong bitcoin address from priv key.
This commit is contained in:
parent
4edbaee96a
commit
a68b0910af
1 changed files with 5 additions and 5 deletions
10
src/eckey.js
10
src/eckey.js
|
@ -48,8 +48,9 @@ ECKey.prototype.import = function (input,compressed) {
|
|||
: null
|
||||
};
|
||||
|
||||
ECKey.prototype.getPub = function() {
|
||||
return ECPubKey(ecparams.getG().multiply(this.priv),this.compressed)
|
||||
ECKey.prototype.getPub = function(compressed) {
|
||||
if (compressed === undefined) compressed = this.compressed
|
||||
return ECPubKey(ecparams.getG().multiply(this.priv),compressed)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -137,7 +138,7 @@ ECPubKey.prototype['export'] = function(format) {
|
|||
|
||||
ECPubKey.prototype.toBytes = function(compressed) {
|
||||
if (compressed === undefined) compressed = this.compressed
|
||||
return this.pub.getEncoded(this.compressed)
|
||||
return this.pub.getEncoded(compressed)
|
||||
}
|
||||
|
||||
ECPubKey.prototype.toHex = function() {
|
||||
|
@ -159,10 +160,9 @@ ECPubKey.prototype.toString = function() {
|
|||
}
|
||||
|
||||
ECPubKey.prototype.getBitcoinAddress = function(v) {
|
||||
return new Address(util.sha256ripe160(this.export()),v);
|
||||
return new Address(util.sha256ripe160(this.toBytes()), v);
|
||||
}
|
||||
|
||||
|
||||
ECKey.prototype.sign = function (hash) {
|
||||
return ecdsa.sign(hash, this.priv);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue