cleanup.
This commit is contained in:
parent
c33a88fb9e
commit
096f71ba1a
@ -1925,11 +1925,8 @@ Script.isScripthashInput = function isScripthashInput(code, isWitness) {
|
||||
};
|
||||
|
||||
Script.prototype.getCoinbaseData = function getCoinbaseData() {
|
||||
var coinbase, flags;
|
||||
|
||||
coinbase = {
|
||||
script: this
|
||||
};
|
||||
var coinbase = {};
|
||||
var flags;
|
||||
|
||||
if (Buffer.isBuffer(this.code[0]) && this.code[0].length <= 6)
|
||||
coinbase.height = new bn(this.code[0], 'le').toNumber();
|
||||
@ -1956,36 +1953,20 @@ Script.prototype.getCoinbaseData = function getCoinbaseData() {
|
||||
return coinbase;
|
||||
};
|
||||
|
||||
// Detect script array types. Note: these functions
|
||||
// are not mutually exclusive. Only use for
|
||||
// verification, not detection.
|
||||
|
||||
Script.isHash = function isHash(hash) {
|
||||
if (!Buffer.isBuffer(hash))
|
||||
return false;
|
||||
|
||||
return hash.length === 20;
|
||||
return Buffer.isBuffer(hash) && hash.length === 20;
|
||||
};
|
||||
|
||||
Script.isKey = function isKey(key) {
|
||||
if (!Buffer.isBuffer(key))
|
||||
return false;
|
||||
|
||||
return key.length >= 33 && key.length <= 65;
|
||||
return Buffer.isBuffer(key) && key.length >= 33 && key.length <= 65;
|
||||
};
|
||||
|
||||
Script.isSignature = function isSignature(sig) {
|
||||
if (!Buffer.isBuffer(sig))
|
||||
return false;
|
||||
|
||||
return sig.length >= 9 && sig.length <= 73;
|
||||
return Buffer.isBuffer(sig) && sig.length >= 9 && sig.length <= 73;
|
||||
};
|
||||
|
||||
Script.isDummy = function isDummy(data) {
|
||||
if (!Buffer.isBuffer(data))
|
||||
return false;
|
||||
|
||||
return data.length === 0;
|
||||
return Buffer.isBuffer(data) && data.length === 0;
|
||||
};
|
||||
|
||||
Script.isZero = function isZero(op) {
|
||||
@ -1996,10 +1977,7 @@ Script.isZero = function isZero(op) {
|
||||
};
|
||||
|
||||
Script.isData = function isData(data) {
|
||||
if (!Buffer.isBuffer(data))
|
||||
return false;
|
||||
|
||||
return data.length <= constants.script.maxOpReturn;
|
||||
return Buffer.isBuffer(data) && data.length <= constants.script.maxOpReturn;
|
||||
};
|
||||
|
||||
Script.isValidKey = function isValidKey(key, flags) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user