fix API using the new thin object model

This commit is contained in:
Matias Alejo Garcia 2014-01-08 17:15:46 -03:00
parent 5509e941ba
commit 451b24d4a8
3 changed files with 4 additions and 5 deletions

View File

@ -13,10 +13,10 @@ var mongoose = require('mongoose'),
* Find block by hash ...
*/
exports.block = function(req, res, next, hash) {
Block.fromHash(hash, function(err, block) {
Block.fromHashWithInfo(hash, function(err, block) {
if (err) return next(err);
if (!block) return next(new Error('Failed to load block ' + hash));
req.block = block;
req.block = block.info;
next();
});
};

View File

@ -15,10 +15,10 @@ var Transaction = require('../models/Transaction');
* Find block by hash ...
*/
exports.transaction = function(req, res, next, txid) {
Transaction.fromID(txid, function(err, tx) {
Transaction.fromIdWithInfo(txid, function(err, tx) {
if (err) return next(err);
if (!tx) return next(new Error('Failed to load TX ' + txid));
req.transaction = tx;
req.transaction = tx.info;
next();
});
};

View File

@ -5,7 +5,6 @@
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
async = require('async'),
RpcClient = require('bitcore/RpcClient').class(),
config = require('../../config/config')
;