fix tests
This commit is contained in:
parent
98be01b207
commit
94f1afbad7
20
.jsbeautifyrc
Normal file
20
.jsbeautifyrc
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"indent_size": 2,
|
||||||
|
"indent_char": " ",
|
||||||
|
"indent_level": 0,
|
||||||
|
"indent_with_tabs": false,
|
||||||
|
"preserve_newlines": true,
|
||||||
|
"max_preserve_newlines": 10,
|
||||||
|
"jslint_happy": false,
|
||||||
|
"space_after_anon_function": true,
|
||||||
|
"brace_style": "collapse",
|
||||||
|
"keep_array_indentation": false,
|
||||||
|
"keep_function_indentation": false,
|
||||||
|
"space_before_conditional": true,
|
||||||
|
"break_chained_methods": false,
|
||||||
|
"eval_code": false,
|
||||||
|
"unescape_strings": false,
|
||||||
|
"wrap_line_length": 0,
|
||||||
|
"good-stuff": true
|
||||||
|
|
||||||
|
}
|
||||||
@ -169,62 +169,41 @@ Script.prototype.toString = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Script.prototype.isOpReturn = function() {
|
Script.prototype.isOpReturn = function() {
|
||||||
if (this.chunks[0] === Opcode('OP_RETURN').toNumber() &&
|
return (this.chunks[0] === Opcode('OP_RETURN').toNumber() &&
|
||||||
(this.chunks.length === 1 ||
|
(this.chunks.length === 1 ||
|
||||||
(this.chunks.length === 2 &&
|
(this.chunks.length === 2 &&
|
||||||
this.chunks[1].buf &&
|
this.chunks[1].buf &&
|
||||||
this.chunks[1].buf.length <= 40 &&
|
this.chunks[1].buf.length <= 40 &&
|
||||||
this.chunks[1].length === this.chunks.len))) {
|
this.chunks[1].length === this.chunks.len)));
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Script.prototype.isPublicKeyHashOut = function() {
|
Script.prototype.isPublicKeyHashOut = function() {
|
||||||
if (this.chunks[0] === Opcode('OP_DUP').toNumber() &&
|
return this.chunks[0] === Opcode('OP_DUP').toNumber() &&
|
||||||
this.chunks[1] === Opcode('OP_HASH160').toNumber() &&
|
this.chunks[1] === Opcode('OP_HASH160').toNumber() &&
|
||||||
this.chunks[2].buf &&
|
this.chunks[2].buf &&
|
||||||
this.chunks[3] === Opcode('OP_EQUALVERIFY').toNumber() &&
|
this.chunks[3] === Opcode('OP_EQUALVERIFY').toNumber() &&
|
||||||
this.chunks[4] === Opcode('OP_CHECKSIG').toNumber()) {
|
this.chunks[4] === Opcode('OP_CHECKSIG').toNumber();
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Script.prototype.isPublicKeyHashIn = function() {
|
Script.prototype.isPublicKeyHashIn = function() {
|
||||||
if (this.chunks.length === 2 &&
|
return !!(this.chunks.length === 2 &&
|
||||||
this.chunks[0].buf &&
|
this.chunks[0].buf &&
|
||||||
this.chunks[1].buf) {
|
this.chunks[1].buf);
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Script.prototype.isScriptHashOut = function() {
|
Script.prototype.isScriptHashOut = function() {
|
||||||
if (this.chunks.length === 3 &&
|
return this.chunks.length === 3 &&
|
||||||
this.chunks[0] === Opcode('OP_HASH160').toNumber() &&
|
this.chunks[0] === Opcode('OP_HASH160').toNumber() &&
|
||||||
this.chunks[1].buf &&
|
this.chunks[1].buf &&
|
||||||
this.chunks[1].buf.length === 20 &&
|
this.chunks[1].buf.length === 20 &&
|
||||||
this.chunks[2] === Opcode('OP_EQUAL').toNumber()) {
|
this.chunks[2] === Opcode('OP_EQUAL').toNumber();
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//note that these are frequently indistinguishable from pubkeyhashin
|
//note that these are frequently indistinguishable from pubkeyhashin
|
||||||
Script.prototype.isScriptHashIn = function() {
|
Script.prototype.isScriptHashIn = function() {
|
||||||
var allpush = this.chunks.every(function(chunk) {
|
return this.chunks.every(function(chunk) {
|
||||||
return Buffer.isBuffer(chunk.buf);
|
return Buffer.isBuffer(chunk.buf);
|
||||||
});
|
});
|
||||||
if (allpush) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Script.prototype.add = function(obj) {
|
Script.prototype.add = function(obj) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user