move sizePush.
This commit is contained in:
parent
aa24f6facf
commit
3bb03c63fa
@ -936,7 +936,7 @@ MTX.prototype.maxSize = function maxSize(options, force) {
|
||||
if (redeem) {
|
||||
prev = redeem;
|
||||
sz = prev.getSize();
|
||||
size += utils.sizePush(sz);
|
||||
size += bcoin.script.sizePush(sz);
|
||||
size += sz;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4296,6 +4296,26 @@ Script.isBadPush = function isBadPush(op) {
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate the size (including
|
||||
* the opcode) of a pushdata.
|
||||
* @param {Number} num - Pushdata data length.
|
||||
* @returns {Number} size
|
||||
*/
|
||||
|
||||
Script.sizePush = function sizePush(num) {
|
||||
if (num <= 0x4b)
|
||||
return 1;
|
||||
|
||||
if (num <= 0xff)
|
||||
return 2;
|
||||
|
||||
if (num <= 0xffff)
|
||||
return 3;
|
||||
|
||||
return 5;
|
||||
};
|
||||
|
||||
/**
|
||||
* Test an object to see if it is a Script.
|
||||
* @param {Object} obj
|
||||
|
||||
@ -2126,26 +2126,6 @@ utils.sizeVarint = function sizeVarint(num) {
|
||||
return 9;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate the size (including
|
||||
* the opcode) of a pushdata.
|
||||
* @param {Number} num - Pushdata data length.
|
||||
* @returns {Number} size
|
||||
*/
|
||||
|
||||
utils.sizePush = function sizePush(num) {
|
||||
if (num <= 0x4b)
|
||||
return 1;
|
||||
|
||||
if (num <= 0xff)
|
||||
return 2;
|
||||
|
||||
if (num <= 0xffff)
|
||||
return 3;
|
||||
|
||||
return 5;
|
||||
};
|
||||
|
||||
/**
|
||||
* Buffer comparator (memcmp + length comparison).
|
||||
* @param {Buffer} a
|
||||
|
||||
Loading…
Reference in New Issue
Block a user