diff --git a/lib/http/server.js b/lib/http/server.js index 23fb3d97..374ee2e5 100644 --- a/lib/http/server.js +++ b/lib/http/server.js @@ -279,8 +279,7 @@ HTTPServer.prototype.initRouter = function initRouter() { } const height = await this.chain.getHeight(hash); - const confirmations = this.chain.height - height; - + res.send(200, block.getJSON(this.network, view, height, confirmations)); }); diff --git a/lib/primitives/txmeta.js b/lib/primitives/txmeta.js index 6685e222..9f9e92dc 100644 --- a/lib/primitives/txmeta.js +++ b/lib/primitives/txmeta.js @@ -157,8 +157,10 @@ TXMeta.prototype.getJSON = function getJSON(network, view, chainheight) { json.height = this.height; json.block = this.block ? util.revHex(this.block) : null; json.time = this.time; - if (chainheight) - json.confirmations = chainheight - this.height; + if (this.block === null) + json.confirmations = 0; + else + json.confirmations = chainheight - this.height + 1; return json; };