allow sloppy scripts.

This commit is contained in:
Christopher Jeffrey 2016-06-14 19:32:01 -07:00
parent f1e1873514
commit ac8a09a55c
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 9 additions and 9 deletions

View File

@ -242,7 +242,7 @@ MTX.prototype.scriptInput = function scriptInput(index, addr) {
vector = input.script;
}
if (prev.isPubkey()) {
if (prev.isPubkey(true)) {
// P2PK
if (!utils.equal(prev.get(1), addr.publicKey))
return false;
@ -252,7 +252,7 @@ MTX.prototype.scriptInput = function scriptInput(index, addr) {
return true;
vector.set(0, opcodes.OP_0);
} else if (prev.isPubkeyhash()) {
} else if (prev.isPubkeyhash(true)) {
// P2PKH
if (!utils.equal(prev.get(2), addr.keyHash))
return false;
@ -412,7 +412,7 @@ MTX.prototype.signInput = function signInput(index, addr, key, type) {
signature = this.createSignature(index, prev, key, type, version);
// P2PK
if (prev.isPubkey()) {
if (prev.isPubkey(true)) {
// Already signed.
if (Script.isSignature(vector.get(0)))
return true;
@ -428,7 +428,7 @@ MTX.prototype.signInput = function signInput(index, addr, key, type) {
}
// P2PKH
if (prev.isPubkeyhash()) {
if (prev.isPubkeyhash(true)) {
// Already signed.
if (Script.isSignature(vector.get(0)))
return true;
@ -598,10 +598,10 @@ MTX.prototype.isSigned = function isSigned() {
len = vector.length;
}
if (prev.isPubkey()) {
if (prev.isPubkey(true)) {
if (!Script.isSignature(vector.get(0)))
return false;
} else if (prev.isPubkeyhash()) {
} else if (prev.isPubkeyhash(true)) {
if (!Script.isSignature(vector.get(0)))
return false;
} else if (prev.isMultisig()) {
@ -866,11 +866,11 @@ MTX.prototype.maxSize = function maxSize(options, force) {
}
}
if (prev.isPubkey()) {
if (prev.isPubkey(true)) {
// P2PK
// OP_PUSHDATA0 [signature]
size += 1 + 73;
} else if (prev.isPubkeyhash()) {
} else if (prev.isPubkeyhash(true)) {
// P2PKH
// OP_PUSHDATA0 [signature]
size += 1 + 73;

View File

@ -1659,7 +1659,7 @@ TX.prototype.isWatched = function isWatched(filter) {
outpoint = bcoin.protocol.framer.outpoint(this.hash(), i);
filter.add(outpoint);
} else if (filter.update === constants.filterFlags.PUBKEY_ONLY) {
if (output.script.isPubkey() || output.script.isMultisig()) {
if (output.script.isPubkey(true) || output.script.isMultisig()) {
outpoint = bcoin.protocol.framer.outpoint(this.hash(), i);
filter.add(outpoint);
}