transactions: switch to use req.param

so that the last argument is the next callback
This commit is contained in:
Braydon Fuller 2016-05-10 16:55:16 -04:00
parent 7973e2398a
commit 98d5314ef2
2 changed files with 16 additions and 7 deletions

View File

@ -21,8 +21,9 @@ TxController.prototype.show = function(req, res) {
/**
* Find transaction by hash ...
*/
TxController.prototype.transaction = function(req, res, next, txid) {
TxController.prototype.transaction = function(req, res, next) {
var self = this;
var txid = req.params.txid;
this.node.getTransactionWithBlockInfo(txid, function(err, transaction) {
if (err && err.code === -5) {
@ -189,8 +190,8 @@ TxController.prototype.transformInvTransaction = function(transaction) {
return transformed;
};
TxController.prototype.rawTransaction = function(req, res, next, txid) {
var self = this;
TxController.prototype.rawTransaction = function(req, res, next) {
var txid = req.params.txid;
this.node.getTransaction(txid, function(err, transaction) {
if (err && err.code === -5) {

View File

@ -187,7 +187,11 @@ describe('Transactions', function() {
};
var transactions = new TxController(node);
var req = {};
var req = {
params: {
txid: txid
}
};
var res = {};
var next = function() {
var merged = _.merge(req.transaction, todos);
@ -196,7 +200,7 @@ describe('Transactions', function() {
};
var txid = 'b85334bf2df35c6dd5b294efe92ffc793a78edff75a2ca666fc296ffb04bbba0';
transactions.transaction(req, res, next, txid);
transactions.transaction(req, res, next);
});
});
@ -849,13 +853,17 @@ describe('Transactions', function() {
var transactions = new TxController(node);
var res = {};
var req = {};
var req = {
params: {
txid: txid
}
};
var next = function() {
should(req.rawTransaction.rawtx).eql(hex);
done();
};
var txid = '25a988e54b02e0e5df146a0f8fa7b9db56210533a9f04bdfda5f4ceb6f77aadd';
transactions.rawTransaction(req, res, next, txid);
transactions.rawTransaction(req, res, next);
});
});