2014-01-07 20:47:20 -08:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
|
|
var Transaction = require('../models/Transaction');
|
|
|
|
//, _ = require('lodash');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Module dependencies.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Find block by hash ...
|
|
|
|
*/
|
|
|
|
exports.transaction = function(req, res, next, txid) {
|
2014-01-08 12:15:46 -08:00
|
|
|
Transaction.fromIdWithInfo(txid, function(err, tx) {
|
2014-01-07 20:47:20 -08:00
|
|
|
if (err) return next(err);
|
|
|
|
if (!tx) return next(new Error('Failed to load TX ' + txid));
|
2014-01-08 12:15:46 -08:00
|
|
|
req.transaction = tx.info;
|
2014-01-07 20:47:20 -08:00
|
|
|
next();
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show block
|
|
|
|
*/
|
|
|
|
exports.show = function(req, res) {
|
|
|
|
res.jsonp(req.transaction);
|
|
|
|
};
|
|
|
|
|