Full public key validation isn't necessary.
This commit is contained in:
parent
febbcc6a6e
commit
770e0e3a7f
|
@ -245,7 +245,6 @@ Script.prototype.isPublicKeyHashOut = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* @param {boolean} inaccurate - option to disable full (slow) public key validation
|
||||
* @returns {boolean} if this is a pay to public key hash input script
|
||||
*/
|
||||
Script.prototype.isPublicKeyHashIn = function(inaccurate) {
|
||||
|
@ -259,16 +258,12 @@ Script.prototype.isPublicKeyHashIn = function(inaccurate) {
|
|||
pubkeyBuf.length
|
||||
) {
|
||||
var version = pubkeyBuf[0];
|
||||
var isVersion = false;
|
||||
if (version === 0x04 && pubkeyBuf.length === 65) {
|
||||
isVersion = true;
|
||||
if ((version === 0x04 ||
|
||||
version === 0x06 ||
|
||||
version === 0x07) && pubkeyBuf.length === 65) {
|
||||
return true;
|
||||
} else if ((version === 0x03 || version === 0x02) && pubkeyBuf.length === 33) {
|
||||
isVersion = true;
|
||||
}
|
||||
if (inaccurate) {
|
||||
return isVersion;
|
||||
} else {
|
||||
return PublicKey.isValid(pubkeyBuf);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -774,7 +769,7 @@ Script.prototype.getAddressInfo = function() {
|
|||
} else if (this.isPublicKeyHashOut()) {
|
||||
info.hashBuffer = this.getData();
|
||||
info.type = Address.PayToPublicKeyHash;
|
||||
} else if (this.isPublicKeyHashIn(true)) {
|
||||
} else if (this.isPublicKeyHashIn()) {
|
||||
// hash the publickey found in the scriptSig
|
||||
info.hashBuffer = Hash.sha256ripemd160(this.chunks[1].buf);
|
||||
info.type = Address.PayToPublicKeyHash;
|
||||
|
|
Loading…
Reference in New Issue