Check that the public key is valid for outputs.
This commit is contained in:
parent
9f4b1a2c26
commit
ad9dd2a41f
|
@ -282,12 +282,16 @@ Script.prototype.isPublicKeyOut = function() {
|
|||
this.chunks[1].opcodenum === Opcode.OP_CHECKSIG) {
|
||||
var pubkeyBuf = this.chunks[0].buf;
|
||||
var version = pubkeyBuf[0];
|
||||
var isVersion = false;
|
||||
if ((version === 0x04 ||
|
||||
version === 0x06 ||
|
||||
version === 0x07) && pubkeyBuf.length === 65) {
|
||||
return true;
|
||||
isVersion = true;
|
||||
} else if ((version === 0x03 || version === 0x02) && pubkeyBuf.length === 33) {
|
||||
return true;
|
||||
isVersion = true;
|
||||
}
|
||||
if (isVersion) {
|
||||
return PublicKey.isValid(pubkeyBuf);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue