From 3625a4f4c9f595ffaf714a5061fea8aa36ca85b8 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 30 Dec 2015 14:34:16 -0800 Subject: [PATCH] minor fixes. --- lib/bcoin/script.js | 2 +- lib/bcoin/tx.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/bcoin/script.js b/lib/bcoin/script.js index ffb0ddc0..4fd5c496 100644 --- a/lib/bcoin/script.js +++ b/lib/bcoin/script.js @@ -560,7 +560,7 @@ script.execute = function execute(s, stack, tx, index, recurse) { n = new bn(0); switch (o) { case 'add': - n = n1.add(b2); + n = n1.add(n2); break; case 'sub': n = n1.sub(n2); diff --git a/lib/bcoin/tx.js b/lib/bcoin/tx.js index 2bc8a4bd..b304506a 100644 --- a/lib/bcoin/tx.js +++ b/lib/bcoin/tx.js @@ -852,10 +852,10 @@ TX.prototype.getConfirmations = function getConfirmations(chain) { if (!chain) return 0; - top = chain.index.heights[chain.index.heights.length - 1]; + top = chain.getHeight(chain.index.hashes[chain.index.hashes.length - 1]); height = this.getHeight(chain); - if (height === -1) + if (top === -1 || height === -1) return 0; return top - height + 1;