diff --git a/lib/transactions.js b/lib/transactions.js index fb1ed05..8f2056c 100644 --- a/lib/transactions.js +++ b/lib/transactions.js @@ -31,7 +31,7 @@ TxController.prototype.transaction = function(req, res, next, txid) { if(err) { return res.send({ error: err.toString() - }) + }); } req.transaction = self.transformTransaction(transaction); @@ -71,7 +71,9 @@ TxController.prototype.transformTransaction = function(transaction) { transformed.blockhash = transaction.__blockHash; transformed.confirmations = confirmations; transformed.time = transaction.__timestamp ? transaction.__timestamp : Math.round(Date.now() / 1000); // can we get this from bitcoind? - transformed.blocktime = transformed.time; + if (transformed.confirmations) { + transformed.blocktime = transformed.time; + } if(transaction.isCoinbase()) { transformed.isCoinBase = true; @@ -275,4 +277,4 @@ TxController.prototype.send = function(req, res) { }); }; -module.exports = TxController; \ No newline at end of file +module.exports = TxController;