Only include blocktime if transaction is in a block.
This commit is contained in:
parent
b32eeec4d6
commit
dc791a2f24
@ -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;
|
||||
module.exports = TxController;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user