From ec5c548fe1ab830a69a0390279b4b0f724475a33 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sun, 17 Apr 2016 21:11:52 -0700 Subject: [PATCH] fix coinbase height. --- lib/bcoin/script.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/bcoin/script.js b/lib/bcoin/script.js index 8d0cc901..8b9db1e7 100644 --- a/lib/bcoin/script.js +++ b/lib/bcoin/script.js @@ -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;