fix API using the new thin object model
This commit is contained in:
parent
5509e941ba
commit
451b24d4a8
|
@ -13,10 +13,10 @@ var mongoose = require('mongoose'),
|
||||||
* Find block by hash ...
|
* Find block by hash ...
|
||||||
*/
|
*/
|
||||||
exports.block = function(req, res, next, 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 (err) return next(err);
|
||||||
if (!block) return next(new Error('Failed to load block ' + hash));
|
if (!block) return next(new Error('Failed to load block ' + hash));
|
||||||
req.block = block;
|
req.block = block.info;
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,10 +15,10 @@ var Transaction = require('../models/Transaction');
|
||||||
* Find block by hash ...
|
* Find block by hash ...
|
||||||
*/
|
*/
|
||||||
exports.transaction = function(req, res, next, txid) {
|
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 (err) return next(err);
|
||||||
if (!tx) return next(new Error('Failed to load TX ' + txid));
|
if (!tx) return next(new Error('Failed to load TX ' + txid));
|
||||||
req.transaction = tx;
|
req.transaction = tx.info;
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
var mongoose = require('mongoose'),
|
var mongoose = require('mongoose'),
|
||||||
Schema = mongoose.Schema,
|
Schema = mongoose.Schema,
|
||||||
async = require('async'),
|
|
||||||
RpcClient = require('bitcore/RpcClient').class(),
|
RpcClient = require('bitcore/RpcClient').class(),
|
||||||
config = require('../../config/config')
|
config = require('../../config/config')
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in New Issue