fix coinbase height.

This commit is contained in:
Christopher Jeffrey 2016-04-17 21:11:52 -07:00
parent f4c991ab77
commit ec5c548fe1
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -2891,9 +2891,18 @@ Script.prototype.getCoinbaseHeight = function getCoinbaseHeight() {
*/
Script.getCoinbaseHeight = function getCoinbaseHeight(code) {
var height;
if (code.length === 0)
return -1;
if (typeof code[0] === 'number') {
height = Script.getSmall(code[0]);
if (height == null)
return -1;
return height;
}
if (!Buffer.isBuffer(code[0]))
return -1;