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) {
|
if(err) {
|
||||||
return res.send({
|
return res.send({
|
||||||
error: err.toString()
|
error: err.toString()
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
req.transaction = self.transformTransaction(transaction);
|
req.transaction = self.transformTransaction(transaction);
|
||||||
@ -71,7 +71,9 @@ TxController.prototype.transformTransaction = function(transaction) {
|
|||||||
transformed.blockhash = transaction.__blockHash;
|
transformed.blockhash = transaction.__blockHash;
|
||||||
transformed.confirmations = confirmations;
|
transformed.confirmations = confirmations;
|
||||||
transformed.time = transaction.__timestamp ? transaction.__timestamp : Math.round(Date.now() / 1000); // can we get this from bitcoind?
|
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()) {
|
if(transaction.isCoinbase()) {
|
||||||
transformed.isCoinBase = true;
|
transformed.isCoinBase = true;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user