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